pmmp / ext-pmmpthread

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

Single-copy strings #71

Closed dktapps closed 1 year ago

dktapps commented 3 years ago

It recently came to my attention that it's possible to make only a single copy of strings, if the assigning context keeps the assigned string around long enough to be copied directly.

This would involve:

This would give us a performance improvement in PM in many cases:

dktapps commented 1 year ago

A problem that might nerf the advantage of this is needing to do a bytewise comparison of strings to determine whether the cached version is the same as the local version.