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

Performance section #67

Closed
snypelife opened this issue Nov 15, 2017 · 1 comment
Closed

Performance section #67

snypelife opened this issue Nov 15, 2017 · 1 comment

Comments

@snypelife
Copy link

I've found that working with JS data structures in an immutable way has significantly improved application performance.

Oversimplified example:

// mutation operation
const list = []
list.push('foo')

// immutable operation
let list = []
list = list.concat('foo')

While it may seem counter-intuitive in terms of working with completely new objects/values, when operating inside of complex loops/algorithms it has made both understanding what's happening to the data far easier to comprehend, as well you avoid scenarios where mutations can be far reaching and difficult to trace.

My team has successfully adopted this approach with one of our production APIs, and found it quite significantly improved performance.

We then took it a step further and use @substack's deep-freeze module as a simple safe guard against mutations.

This is one example I have, I'll see about digging up some more and/or finding decent articles that help make this more than just anecdotal :) .

@snypelife
Copy link
Author

derp, i'm an idiot and just saw #31, can probably just close this.

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