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

perf: improve memory usage by storing methods on the Tween prototype #325

Closed
wants to merge 2 commits into from

Conversation

trusktr
Copy link
Member

@trusktr trusktr commented Mar 19, 2017

Also keeps private variables private through use of a WeakMap.

keep private variables private through a WeakMap
@trusktr trusktr force-pushed the methods-on-prototype branch from e086272 to 623dc9d Compare March 19, 2017 19:39
@trusktr
Copy link
Member Author

trusktr commented Mar 19, 2017

First time using semantic-release, so hoping I did the commit message right.

@trusktr trusktr force-pushed the methods-on-prototype branch from 8103a15 to 0411368 Compare March 19, 2017 20:09
@trusktr
Copy link
Member Author

trusktr commented Mar 19, 2017

This reduces memory usage (for storing class methods) from O(n) to O(1), where n is the number of Tween instances.

Before: 100 Tween instances -> 1700 Function instances
After: 100 Tween instances -> 17 Function instances

(there are currently 17 methods on the Tween class)

@trusktr trusktr changed the title Improve memory usage by storing methods on the Tween prototype. Also … perf: improve memory usage by storing methods on the Tween prototype Mar 19, 2017
@trusktr
Copy link
Member Author

trusktr commented Mar 19, 2017

@mikebolt @sole @dalisoft

Closing this one in favor of #325 which is compatible with older browsers, we can add new language features after #327.

@trusktr trusktr closed this Mar 19, 2017
@trusktr
Copy link
Member Author

trusktr commented Mar 19, 2017

cc @sole @mikebolt @dalisoft

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

Successfully merging this pull request may close these issues.

1 participant