intelie / immutable-js-diff

MIT License
260 stars 32 forks source link

Performance statement considerations #8

Closed burmisov closed 7 years ago

burmisov commented 8 years ago

Not really an issue, sorry for bothering. Working with immutable data in JS has some well-known performance considerations. Immutable.js lib tries to clearly state performance implications of its different functions. Are there any thoughts on performance implications of this diff process? Does this library have some goals on that? Is it usable in real-time applications? I don't mean to state that the performance is bad - just wondering if there is any thought put specifically into that, or is it more suitable for off-line use.

brenoferreira commented 8 years ago

Good question. We had some issues with performance on big datasets (we had cases of Lists with +10K items). So initially we had an implementation that used the Longest common subsequence algorithm to get the diff of Lists. But the performance was really bad, so since an Immutable List can be accessed like a Map (index -> value), we used the same strategy used for calculating the diffs for Maps, and the performance was much better.

But we don't have any use cases in real-time applications. Feel free to do some tests and I'll keep this issue open for you to post any updates here.

pedroteixeira commented 7 years ago

@burmisov The Commits on Nov 7, 2016 do address some issues we had with performance with very large arrays.