[php-src] Issue #13100: Object allocation and release should be optimized more
| From: | mvorisek | Date: | Tue, 09 Jan 2024 11:13:00 +0000 |
| Subject: | [php-src] Issue #13100: Object allocation and release should be optimized more | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246201@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13100
Author: mvorisek
### Description
Classes are very often used as a simple data holding structure which is created and destroyed
millions times per script lifecycle/run.
In https://3v4l.org/CMktE/rfc#vgit.master I
have discovered a "class like struct" is slower than an array. This is something not fully
surprising on the first sight.
However, https://3v4l.org/hSSFJ/rfc#vgit.master, same demo
with propoted properties only, with empty constructor, is not (much if any) faster.
Initially I thought the interpreted code in the constructor will contribute the most to the total
run time. This seems to be not true, it seems the most of the time is spent in object allocation and
release. If an object has no cycles, it should be fast. I hope there is a room to optimize the
object allocation/release more and make this core part of php faster.