Uh oh!
There was an error while loading. Please reload this page.
lib: micro-optimize EventEmitter#removeListener() - #185
Conversation
sonewman
commented
Dec 20, 2014
👍 |
algesten
commented
Dec 20, 2014
That's super sweet! Perhaps a pedantic point, but shouldn't we call it something else but |
Don't use Number#toPrecision(), it switches to scientific notation for numbers with more digits than the precision; use Number#toFixed(). PR-URL: nodejs#185 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Replace the call to Array#splice() with a faster open-coded version that creates less garbage. Add a new benchmark to prove it. With the change applied, it scores a whopping 40% higher. PR-URL: nodejs#185 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
chrisdickinson
commented
Dec 20, 2014
LGTM. I looked into splitting |
1ee720b to
d3f8db1Comparebnoordhuis
commented
Dec 20, 2014
Cheers, fixed up the indentation and (partially) incorporated @algesten's feedback by renaming the function to spliceOne(). Landed in d3f8db1. @chrisdickinson Using Array#shift() to remove the first element is a bit faster, but only for larger lists. The lower bound is probably at least 16 elements but there doesn't seem to be an appreciable difference until the array length is in the low hundreds. |
Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.
Add a new benchmark to prove it. With the change applied, it scores
a whopping 40% higher.
R=@chrisdickinson