in reply to
Re: Benchmark, -s versus schwartzian
in thread Benchmark, -s versus schwartzian
I don't see why you'd be surprised that creating a single hash would be faster than creating a ton of tiny anonymous arrays. (:
Yes, I realize you expected the hash lookups to be slower than the array lookups. But my first paragraph explains why the hash method will be faster in many cases. Then there is also the fact that a lexical hash avoids having to dereference a reference.
I'm curious which comparison routines get optimized. Unfortunately, the details on that appear to be undocumented (either not mentioned at all or simply glossed over as "many"). I guess I'll have to find and read source code when I'm at a better location for doing that.