saltyrtc / saltyrtc-client-js

SaltyRTC JavaScript implementation.
MIT License
29 stars 6 forks source link

Reduce copying #111

Open lgrahl opened 6 years ago

lgrahl commented 6 years ago

There's a lot of unnecessary byte copying in the code. I would like to change this in a way where the application has to expect side effects if it modifies byte views passed to a function or method that stores this data. The docstring always has to explicitly state if it stores a byte view and for how long. Because of this change, a major release would need to be done.

However, I believe it is the correct approach compared to the other way around (always copy) because that would make it impossible to write an efficient library.

dbrgn commented 6 years ago

The docstring always has to explicitly state if it stores a byte view and for how long.

Ownership and lifetime tracking cough

lgrahl commented 6 years ago

Feel free to extend TypeScript with that feature. :grin: