Much of [this excellent presentation](https://queue.acm.org/detail.cfm?id=3372264) is concerned with const-ness. The bit about GCC “pure” functions is a promise of no side effects, approximately equivalent to SQLite’s “deterministic” UDF qualifier. The optimization depends on the compiler being able to prove that passed values will *remain* `const`. The article also explains why SQLite’s amalgamation build is an effective optimization technique in absence of LTO in the compiler. C++ takes it even further now with `constexpr`, but until someone forks a C++ only variant of SQLite permitting these optimizations, we’re getting off topic…