PHP array implementation that consumes 10x less memory
Here I'm sharing something that I toyed with some long time ago but never shared and found interesting, which is a pure php implementation data structure for arrays that can consume up to 10x less ram than native one:
Posted Jul 10, 2019, 1:59 AM UTC
Did you try Judy?
TIL about Judy
This is another great extension that would be nice to test: https://github.com/php-ds/ext-ds
Ds\Vector uses ~50% as much memory, and Ds\Map using the same amount (but supports objects as keys). Not nearly 10x, but not slower either. Really depends on what you want to optimize for.
Nice! would be interesting to have some script that benchmarks Spl, Judy and Ds extensions, would be really informative.
Dammit. I maybe wouldn't have wasted all that time porting some software to HackLang if I had known about this :-/