Uh oh!
There was an error while loading. Please reload this page.
benchmark: add microbenchmarks for ES Map - #7581
Conversation
There was a problem hiding this comment.
plain old javascript object ... comes from plain old java object, maybe that's just for us old java dogs
There was a problem hiding this comment.
I'll just call it 'object' since it's not obvious
addaleax
commented
Jul 7, 2016
Not sure if it matters, but it might be nice to have one for |
rvagg
commented
Jul 7, 2016
ok, s/pojo/object and added one for a null-prototype object |
cjihrig
commented
Jul 7, 2016
Should this utilize |
There was a problem hiding this comment.
I think we're still preferring var over let.
rvagg
commented
Jul 7, 2016
s/let/var, thanks for pointing that out. I don't know if this is a candidate for |
cjihrig
commented
Jul 7, 2016
I'll defer to someone with more experience working on the benchmarks, but |
mscdex
commented
Jul 7, 2016
AFAIK that should be (million) ops/sec, so technically |
jasnell
commented
Jul 7, 2016
Interesting! Unmodified version: Modified to include map creation on each loop: |
rvagg
commented
Jul 8, 2016
ok then, that is interesting and explains why fakeMap looked "better" than the pojo, perhaps we go ahead and migrate |
mscdex
commented
Jul 8, 2016
@rvagg That would probably have to happen at least in v7 or later since that would be a pretty big change. |
simonkcleung
commented
Jul 10, 2016
The number should be the higher the better? |
mscdex
commented
Jul 10, 2016
@simonkcleung Yes. Values are always operations per second. |
jasnell
commented
Jul 20, 2016
Moving the querystring and headers objects to Maps definitely makes sense given the perf results but @Fishrock123 is right about targeting such a change for v7. We can likely go ahead and get that change landed in master now as a semver-major. |
There was a problem hiding this comment.
Are we trying to set the same two properties ('i10000000' and 's10000000') 10 million times? If so, maybe use keys like 'a', 'b'. Or should the keys be 'i' + i and 's' + i?
fhinkel
commented
Jul 29, 2016
@rvagg Thanks for putting this together. When we're using named keys Every time we add a property to an object, we create a new transition map. Only if we add properties in exactly the same order can we reuse the maps. This is often not the case, for example when we parse request headers into So +1 for moving to maps! |
jasnell
commented
Jul 29, 2016
btw, LGTM for getting this landed. :-) |
jasnell
commented
Aug 4, 2016
@rvagg ... is this ready to land? |
addaleax
commented
Aug 4, 2016
I think @fhinkel’s comment should still be addressed? |
addaleax
commented
Sep 20, 2016
ping @rvagg |
rvagg
commented
Oct 18, 2016
Thanks for catching that @fhinkel, that changes everything! Updates pushed, pls review folks. v6 master |
fhinkel
commented
Oct 18, 2016
LGTM. Should we update the first comment with the new times and also point out, that it's ops/sec rather than seconds (so higher is faster). |
rvagg
commented
Oct 18, 2016
Good idea, done! @fhinkel is there a known speed regression for maps in later V8? We're comparing 5.1 to 5.4 here and that's a big slowdown, or could the test not be getting at the real numbers? |
fhinkel
commented
Oct 18, 2016
I wonder if something else was going on during the benchmarking, because |
rvagg
commented
Oct 18, 2016
yea, I think you're right, new run on master: |
rvagg
commented
Oct 18, 2016
Too much variability between runs, bumping it back up to the millions and it stabilises a bit more: v6 master |
I think we can blame the variation on timing issues. I don't get a regression going from Node v6.0.0: Node v6.7.0: Node master: |
c133999 to
83c7a88Comparervagg
commented
Oct 29, 2016
landed @ 07cc9df |
PR-URL: #7581 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <ranziska.hinkelmann@gmail.com>
PR-URL: #7581 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <ranziska.hinkelmann@gmail.com>
PR-URL: #7581 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <ranziska.hinkelmann@gmail.com>
PR-URL: #7581 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <ranziska.hinkelmann@gmail.com>
Given the discussion in #6102 about
Mapstill being too slow to use I figured I'd see with a benchmark. @mscdex, @jasnell please review and let me know if you think this is valid.As for why the fakeMap test is faster ... I got nothing ...
Update after @fhinkel noticed a serious flaw:
v6
master
Times are ops/sec, so higher is better