3 ms·
I work with PHP, where classes are supposedly a lot slower than strings and arrays (PHP calls dictionaries "associative arrays").
by ronjakoi 8mo ago
I work with PHP, where classes are supposedly a lot slower than strings and arrays (PHP calls dictionaries "associative arrays").
- cogman10 8mo agoBenchmark it, but from what I can find this is dated advice. It might be faster on first load but it'd surprise me if it's always faster. Edit: looking into how PHP has evolved, 8 added a JIT in 2021. That will almost certainly make it faster to use a class rather than an associative array. Associative arrays are very hard for a JIT to look through and optimize around.