Adding leading backslashes to PHP function calls can significantly improve performance through OPcache optimizations. In the paragonie/constant_time_encoding library, prefixing `extension_loaded()` and `sodium_bin2hex()` with backslashes enabled compile-time evaluation and dead code elimination, resulting in an 18× speedup over the pure PHP implementation. OPcache replaces `\extension_loaded('sodium')` with `true` at compile time, removes the conditional check, and eliminates unreachable fallback code. This optimization reduced overhead from 14× to just 2.1× compared to non-constant-time alternatives, making secure encoding practical as a default choice.
2 Comments
Sort: