leoschwarz / opensim-networking

OpenSimulator Networking Client, written in Rust (WIP)
GNU General Public License v3.0
1 stars 1 forks source link

Reduce binary size #3

Open leoschwarz opened 6 years ago

leoschwarz commented 6 years ago

Currently opensim_messages compiles to around 50 MB worth of binary, which is way too much. I tried getting rid of the error-chain crate to see if it changes anything but in fact it didn't.

leoschwarz commented 6 years ago

Some optimizations can be enabled, like opt-level="z" or strip debug info. Both make debugging rather inconvenient and take longer to compile, but they could be added to a release build script. So it probably makes sense to look at this in depth when the time comes.

leoschwarz commented 6 years ago

I was hoping https://github.com/leoschwarz/opensim-networking/commit/c710c718176ccf1c53935e743a1857639fa751ca would help this, but it either has to do something with the generics, or the excessive use of the try macro. If it is the later, maybe we need a byte reader which returns zeros if there is no more content, and only in the end check if we read more bytes than available.

(But this will not help there being a lot of code for the many conversions, so this should also be covered inside the reader struct.)