https://xania.org/202512/03-more-adding-integers #MattGodbolt #CompilerOptimization #EmojiHumor #HumanCleverness #CodingFails #HackerNews #ngated
You’ve probably seen `use function strlen` in PHP and shrugged.
But here’s the twist: in certain cases, it activates a special compiler optimization in PHP that makes some functions significantly faster.
This is your eureka moment! Here’s how it works, when it matters, and how to adopt it easily: https://tideways.com/profiler/blog/compiler-optimized-php-functions?utm_medium=social&utm_source=mastodon&utm_campaign=compiler-optimized-php-functions
#php #opcache #compileroptimization #phptips #webdev #coding #programming #performance
Did you know that for natural numbers:
{x: >= 0, y = 2ⁿ}
the follow holds true:
x mod y
is equal to
x & (y - 1)
Example:
31882511 mod 1024
is equal to
31882511 & 1023
(where `mod` is the modulo operation and `&` is bitwise-and)
#Math #Algorithms #Programming #CompilerOptimization #Performance #Optimization
define-compiler-macro:
🧷 http://www.lispworks.com/documentation/lw50/CLHS/Body/m_define.htm#define-compiler-macro
inline / notinline:
🧷 http://www.lispworks.com/documentation/lw50/CLHS/Body/d_inline.htm#inline
Ooops, wrong language ... 🙈
🌺
🏷️ #CommonLisp #Lisp #Compiler #CompilerExtension #CompilerOptimization #Inlining