| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Not using delete could leave a lot of entries in the various list objects. This is why we use delete in EventEmitter for example. |
Sorry, something went wrong.
Yes but in practical terms this has basically no impact. I've tested access performance on an Object with 1e7 keys and 1e2 keys and it's constant. It's also likely that the keys will be pretty predictable since they're based on user code and unlikely to be random numbers, so constantly deleting and adding them is not really helping anyone.
And that is also being removed in #17324. As far as I can see, we're just sabotaging performance by using delete on Objects that are never iterated over and are likely to have a predictable list of properties. |
Sorry, something went wrong.
|
@mscdex Btw if there's a legitimate reason to not do this that I'm missing, I'm definitely all ears and will remove that change. I just haven't found it in my testing... And that also applies to the events PR linked above. Thanks for the feedback! |
Sorry, something went wrong.
|
Maybe run benchmark/timers on this? |
Sorry, something went wrong.
|
@Trott yeah, it's running right now. Forgot to post a link. https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/69/console |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM if benchmarks and CI are OK.
Sorry, something went wrong.
|
@apapirovski is memory usage the same without delete? |
Sorry, something went wrong.
|
@apapirovski My concern was not about performance, but memory usage. IMHO it is not safe to make any assumptions about what gets passed to setTimeout(), etc. as far as the timeout value goes. |
Sorry, something went wrong.
I did not realize that until now, that is a bad idea IMHO. Even third-party EventEmitter implementations that used to do this switched to delete because of memory issues. |
Sorry, something went wrong.
Addressed. I did actually look at memory as an issue but I think I had my iterations set too low. Once I bumped it up enough, I'm seeing regressions in performance too — not just memory. That said, if our policy is that we don't want to assume end-user input then delete cannot be removed — I don't think the memory issue can ever possibly be optimized enough. Same as events, I think I was too optimistic re: user input being constant (to an extent). |
Sorry, something went wrong.
No longer use delete to remove keys on unrefed & refed lists, instead simply set to undefined. Move all the TimersList instantiation code into the constructor. Compare values to undefined & null as appropriate instead of truthy or falsy.
Sorry, something went wrong.
|
@lpinca would you mind reviewing this given your prior comment here? The delete issue has been resolved. Thanks! |
Sorry, something went wrong.
There was a problem hiding this comment.
SGTM.
Sorry, something went wrong.
Move all the TimersList instantiation code into the constructor. Compare values to undefined & null as appropriate instead of truthy or falsy. PR-URL: #17429 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Move all the TimersList instantiation code into the constructor. Compare values to undefined & null as appropriate instead of truthy or falsy. PR-URL: #17429 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Move all the TimersList instantiation code into the constructor. Compare values to undefined & null as appropriate instead of truthy or falsy. PR-URL: #17429 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
| Back | FazBrowse Home | New Git URL |
A few small refinements to TimersList & ImmediateList:
Checklist
Affected core subsystem(s)
timers