4 ms·
> you could generate better code after having observed the actual arguments to various functions and recompile while treating them as constants This transforma
by mappu 7y ago
> you could generate better code after having observed the actual arguments to various functions and recompile while treating them as constants
This transformation is valid for pure functions; therefore you can mark it constexpr before compiling to WASM. There's the `constexpr-everything` project (among others) that uses libclang to apply constexpr to all legal functions/expressions in a codebase.
That's for C++ - Rust is working on `const fn`.
- saagarjha 7y ago> This transformation is valid for pure functions; therefore you can mark it constexpr before compiling to WASM. It's also valid for non-pure functions at runtime.