4 ms·
Interesting. I did add a return to that benchmark and it didn't seem to affect the results. I would think your test would be identical to mine in performance ch
by Isobit 10y ago
Interesting. I did add a return to that benchmark and it didn't seem to affect the results. I would think your test would be identical to mine in performance characteristics, I wonder if it's just the benchmarking methods leading to the difference. I might just go write my own benchmarking like yours since I don't really know what measurethat.net is doing.
It seems intuitively obvious that map would be less efficient, but who knows what V8 is doing to optimize under the hood.
- mikekchar 10y agoGiven that they are so close in your example, I was thinking that it's possible that both sides are being optimised out, but that since the map side is smaller, it runs faster (i.e. the optimisation is at run time and so it still has to interpret the code -- smaller code interprets faster). I haven't had time to revisit this since, but I think it's important. It is also possible that the profiling support in Chromium and Firefox is broken and I would very much like to know that if it is true.