Re:On self-modifying executables in Rust
by asah on Saturday January 29, 2022 @04:57AM
(#30125149)
It's not precisely "self modifying code" but FYI various systems are starting to use LLVM to specialize code at runtime (aka "JIT"), including Postgres, which is written in old school C.
In the case of Postgres, the code is modified to precisely work for the particular SQL expression and for the particular table schema. This magic is on by default, which means 100 million+ computers are doing this right now. 25-40% speedups on certain queries.
This concept was first inspired in the 1990s by folks like Henry Massalin, and confirmed at Berkeley and elsewhere, but wasn't considered practical until LLVM came along.
In the case of Postgres, the code is modified to precisely work for the particular SQL expression and for the particular table schema. This magic is on by default, which means 100 million+ computers are doing this right now. 25-40% speedups on certain queries.
This concept was first inspired in the 1990s by folks like Henry Massalin, and confirmed at Berkeley and elsewhere, but wasn't considered practical until LLVM came along.
Mic drop and mind blown.
https://severalnines.com/database-blog/overview-just-time-co...
https://www.postgresql.org/docs/current/jit.html
https://www.postgresql.org/docs/current/jit-reason.html#JIT-...
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.29....
https://www2.eecs.berkeley.edu/Pubs/TechRpts/1994/6310.html