pmmp / ext-pmmpthread

Fork of https://github.com/krakjoe/pthreads with a revamped API and PHP 8.1+ support
Other
82 stars 15 forks source link

Intern defined property name strings #92

Closed dktapps closed 1 year ago

dktapps commented 1 year ago

Currently, every shared pthreads structure contains copies of every property name string, since we can't use the ones provided by Zend directly.

This is a waste of performance and memory usage, and can be avoided by introducing an interned strings table to pthreads_globals. Marking strings as interned will allow them to be used in both shared and local property tables, saving memory across the board.

This approach cannot be used for dynamic properties, but a global table of refcounted strings might provide a small benefit for dynamic properties. However, this would have to be protected by globals lock, so it's not clear how beneficial this would be.