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

Reduce memory footprint (issue #854) #872

Merged
merged 2 commits into from
Jun 18, 2018
Merged

Reduce memory footprint (issue #854) #872

merged 2 commits into from
Jun 18, 2018

Conversation

k-g-a
Copy link
Member

@k-g-a k-g-a commented Jun 15, 2018

Good day!
This PR is intended to be merged over current master and become part of 2.0 branch as it makes MST a little bit faster without any visible changes. Those who will not be able migrate to 3.0 as soon as it's released could benefit from this one.

Three points were backported from my previous work:

  • non-observable parent/subpath (#854)
  • lazy middlewares/patchSubscribers/snapshotSubscribers/disposers arrays allocation (this comment)
  • bind() removed from unbox() and applyPatches()/applySnapshot() (this comment)

All tests are passing. I've also tried to use it in project at work - no issues were found.

Comparison (prod builds, master@left, pr@right):
memory

speedtest

I didn't dare to backport other minor changes as those give insignificant impact, but may cause bugs.

- bind() removed from unbox() and applyPatches()/applySnapshot()
- lazy middlewares/patchSubscribers/snapshotSubscribers/disposers arrays allocation
@mweststrate mweststrate merged commit eadf9de into mobxjs:master Jun 18, 2018
@mweststrate
Copy link
Member

Merged! Thanks :)

mweststrate added a commit that referenced this pull request Jun 18, 2018
this.snapshotSubscribers.splice(0)
this.patchSubscribers.splice(0)
if (this.patchSubscribers) this.patchSubscribers.splice(0)
if (this.snapshotSubscribers) this.snapshotSubscribers.splice(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

4 participants