rksm / hot-lib-reloader-rs

Reload Rust code without app restarts. For faster feedback cycles.
MIT License
577 stars 21 forks source link

no_mangle attribute in production systems #10

Closed afonsolage closed 1 year ago

afonsolage commented 1 year ago

If I understood correctly, the HotModule will parse and expose as hot-reloadable all public no_mangle functions, but I was wondering if marking systems functions as #[no_mangle] may impact production performance, since AFAIK Rust compiler won't be able to fully otimize those functions.

It's possible somehow to only mark #[no_mangle] on hot-reload builds?

rksm commented 1 year ago

That is a very good point, thanks for bringing that up. I created a no-mangle-if-debug helper crate to address this and mention that in the tips section.