rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

Performance #128

Closed srolel closed 8 years ago

srolel commented 8 years ago

I would like to use seamless-immutable in production after reviewing the options for implementing immutability. One of the libraries I looked at was timm. The author suggests that seamless has performance issues and provides a benchmark.

rtfeldman commented 8 years ago

Those benchmarks are using seamless-immutable's development build (they must be, since the prod build wouldn't pass the tests he posted), and the development build goes out of its way to freeze things and bans mutating methods.

The production build doesn't do these things. It's very close to "using plain old arrays and objects" in terms of performance, and I don't feel like trying to do better than that is a good goal for the library. 😄

Thanks for the post!

braco commented 8 years ago

@rtfeldman: just FYI, docs were updated to use production seamless-immutable, claims it's still faster:

https://github.com/guigrpa/timm

guigrpa commented 8 years ago

My benchmark code is here: https://github.com/guigrpa/timm/blob/master/tools/benchmarks.js

In principle I'm using the Production build, so I was also surprised by the results, but they seem to be consistent in Windows and OS X. I don't know the reason for the slow array results.

Of course, if the benchmarks are wrong I will publish the updated results!

rtfeldman commented 8 years ago

That's cool! @guigrpa I appreciate your showing your work. 😸

ronniegong commented 7 years ago

so, is seamless-immutable really that slow?