amethyst / specs

Specs - Parallel ECS
https://amethyst.github.io/specs/
Apache License 2.0
2.51k stars 221 forks source link

Add count to serialize. #699

Closed Azaril closed 4 years ago

Azaril commented 4 years ago

Checklist

API changes

This change modifies the behavior of serialize to calculate the count of items before handing off to the serde serializer. The majority of formats that serde supports require a known count to prefix the data with. (i.e. bincode, msgpack). Most of these will fail serialization immediatly when trying to use them with component serialization.

There is additional overhead from calculating the number of items but the cost appears to be trivial in comparison to the time spent on serialization.

I did not modify serialize_recusive as it would require a much more expensive double-traversal of the data structures inspecting for contained entities.

azriel91 commented 4 years ago

bors r+

bors[bot] commented 4 years ago

Build succeeded: