3 ms·
Is it feasible to construct CPU cache friendly programs in interpreted languages like PHP and JavaScript?
by mklepaczewski 3y ago
Is it feasible to construct CPU cache friendly programs in interpreted languages like PHP and JavaScript?
- tyingq 3y agoCache-friendlier than past versions happens all the time for PHP and Javascript. A fair amount of the gains in PHP7 were optimizations that reduced reallocation of memory, "packed arrays" where if an array is all ints to store it in a more compact structure, etc. Polymorphic inline caching would be another example of trying to reduce the performance impact of a dynamically typed language...being more cache friendly despite the handicap of not knowing everything until runtime.
- eatonphil 3y agoIn JavaScript you can use Buffers to allocate bytes and manage memory manually to avoid allocations in hot paths. If you're doing that then yes these techniques can be relevant. And this isn't that obscure, many Node libraries and apps seeking performance do actually do this manual memory management. I just can't find one from a quick search.
- __s 3y agoYes. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Typed_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...