Software engineer, data guy, Open Source enthusiast, New Hampshire resident, husband, father. Fan of guitars, hiking, photography, homebrewing, sarcasm.
Ruby is not Javascript - Benchmarking Hash/Struct Performance
Recently I was using ruby-prof to profile a Rails app and find slow methods. I found a snippet that thoughtlessly used a Hash as a simple object structure in a recursive method. I then recalled something I read back when I was learning Ruby: “Ruby is not Javascript”. By replacing it with a Struct (for example), I got much better performance: