Interesting! I would like to dig deeper or ask google for more information.
I had an impression that I once read a paper about this kind of magic number, but not sure where it was from.
@Dmitry Stogov<mailto:dmitrystogov@gmail.com> With your permission, if I found anything, I would like to add a few comments into the source code file for records.
From: Dmitry Stogov <dmitrystogov@gmail.com>
Sent: Monday, January 17, 2022 8:12 PM
To: Su, Tao <tao.su@intel.com>
Cc: PHP internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] Reason for ZEND_JIT_COUNTER_INIT set to 32531?
Oh, probably this is just the biggest prime number that fits into a signed 16-bit number :)
On Mon, Jan 17, 2022 at 10:49 AM Su, Tao <tao.su@intel.com<mailto:tao.su@intel.com>> wrote:
Thanks Dmitry for the information.
With a few debug sessions, I found that 32531 is working well
for any thresholds, and is also a big prime number :-).
-----Original Message-----
From: Dmitry Stogov <dmitrystogov@gmail.com<mailto:dmitrystogov@gmail.com>>
Sent: Monday, January 17, 2022 1:37 PM
To: Su, Tao <tao.su@intel.com<mailto:tao.su@intel.com>>
Cc: PHP internals <internals@lists.php.net<mailto:internals@lists.php.net>>
Subject: Re: [PHP-DEV] Reason for ZEND_JIT_COUNTER_INIT set to 32531?
This it's my choice.
This number is common for all JIT counters (hot_loop, hot_func, hot_return).
It's value was selected to provide the best precision when different counters have different thresholds.
Unfortunately, I can't remember the exact equations or logic I used at that time.
Thanks. Dmitry.
On Thu, Jan 13, 2022 at 1:01 PM Su, Tao <tao.su@intel.com<mailto:tao.su@intel.com>> wrote: