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

Change default of thread inheritance #113

Closed dktapps closed 1 year ago

dktapps commented 1 year ago

While we can't yet get rid of thread code inheritance, we can reduce its performance impact by disabling inheritance by default.

In practice, most people will rely on autoloading anyway, which is the preferred strategy, since this takes less memory and is more reliable. Code inheritance also has a massive performance cost in large applications (see #63), so this feature is just causing unnecessary slowdowns.

A more practical default setting would probably be INHERIT_INI | INHERIT_COMMENTS. (INHERIT_COMMENTS is needed for internal technical reasons - copied Runnable classes won't correctly inherit their doc comments without it).

dktapps commented 1 year ago

Since b81959d1f2f30087dd6e6badc5aab4685b68392f, the start options must be specified by the user.