Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory optimization #34

Open
medikoo opened this issue Feb 25, 2015 · 5 comments
Open

Memory optimization #34

medikoo opened this issue Feb 25, 2015 · 5 comments
Assignees
Milestone

Comments

@medikoo
Copy link
Owner

medikoo commented Feb 25, 2015

Currently for each memoized function there are few functions created, that affects memory badly when our configration deals with thousands of memoized instances. It'll be much more optimal to rely on prototype inheritance model in that case

@medikoo medikoo self-assigned this Feb 25, 2015
@medikoo medikoo added this to the v1 milestone Feb 25, 2015
@medikoo medikoo changed the title Memory optmization Memory optimization Apr 28, 2015
@puzrin
Copy link

puzrin commented Oct 2, 2015

As far as i remember, perf problem also can happen on thousands of setTimeout(). Solution is to have a list of deadlines, and scan it with single timer.

@medikoo
Copy link
Owner Author

medikoo commented Oct 2, 2015

@puzrin true, it's a great tip

@puzrin
Copy link

puzrin commented May 29, 2016

For setTimeout it's possible to use the same function if you pass params:

.setTimeout(fn, delay, param1, param2, ...)

In browser that will require patch for IE <= 9 https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout

@medikoo
Copy link
Owner Author

medikoo commented May 30, 2016

For setTimeout it's possible to use the same function if you pass params:

I'm not convinced it'll bring anything noticeable in terms of performance. I'm sure it's more important to produce less setTimeout calls (decide on some threshold) as you suggested before

@puzrin
Copy link

puzrin commented May 30, 2016

https://github.com/nodejs/node/blob/master/lib/timers.js#L283 there are unofficial enroll/unenroll functions. Can be used instead of setTimeout/clearTimeout. But i'm not sure this hack is really needed.

@medikoo medikoo mentioned this issue Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants