canjs / can-connect

Model layer utilities for every JavaScript framework! Assemble real-time, high performance, restful data connections.
https://canjs.com/doc/can-connect.html
MIT License
29 stars 16 forks source link

Avoid serialization during real-time updates #416

Closed phillipskevin closed 6 years ago

phillipskevin commented 6 years ago

During real-time updates, the list is serialized so that updatedList can be called:

https://github.com/canjs/can-connect/blob/12ed9051c861f08d5ff6d2952d500221a20e0599/real-time/real-time.js#L431-L455

This serialization is a performance bottleneck and should be avoided.

canSet.index can handle finding the index of the updated item (props) in the list directly instead of in the serialized list. Then the updated item (hydrateInstance( props )) can be spliced directly into the list.

justinbmeyer commented 6 years ago

I did this for 5.0: https://github.com/canjs/can-connect/pull/415