Topic #4433 (no title)
0 guests and 0 members have recently viewed this.
The top 3 point earners from 14th Dec 2025 to 21st Dec 2025.
| PDStig |
|
|
|---|---|---|
| Gabri |
|
|
| sholzy |
|
|
There are no events at this time
#4311 - Make Tempcode use SPL, for reduced memory usage
It produces significant memory gains (perhaps 25% less usage by Composr overall, but I didn't gather proper figures). However, what I didn't consider is the CPU speed differences, and testing is showing me that SplDoublyLinkedList takes 3x time to do an array append and 2x time to do an array iteration. I'd rather optimise for speed than memory, you can easily add more RAM and generally Composr has more of a practical cost for speed than memory use.
PHP 7 is highly optimised with an engine-based array implementation. SPL cannot benefit from that and has to go through PHP's object interfaces for overriding array operations.
Here's an interesting discussion around a new PHP extension that does what SPL is doing but faster:
https://www.reddit.com/r/PHP/comments/44qsco/efficient_data_structures_for_php_7/
Maybe it will eventually reach core, or something similar will, in which case we can eventually use it.