Re: Optimization for ..._MULTIPLY_LONG on more systems
| From: | Matt Wilmas | Date: | Thu, 17 Jul 2008 14:20:18 +0000 |
| Subject: | Re: Optimization for ..._MULTIPLY_LONG on more systems | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39055@lists.php.net to get a copy of this message | ||
Hi all,
Replying to this OLD message about the ZEND_SIGNED_MULTIPLY_LONG() change...
It's just a small thing, but it's been on the TODO for a while, so I
attempted to correct the issue with my original patch that used "long long"
type, which wasn't available on the older MSVC versions, etc. I created a
zend_long64 type (when possible, #if logic copied from snprintf.h's WIDE_INT
definition), hopefully it's mostly correct/OK, and maybe it can be used
elsewhere too.
Since the new memory manager, ..._MULTIPLY_LONG() isn't used for
safe_emalloc() anymore, so I made another safe_address() variation (overflow
safe, I hope). I noticed ~0.6% slowdown on bench.php, though it seems this
zend_ulong64 version should use fewer cycles than the doubles one for sure,
if someone wants to analyze it more. :-)
Finally, is it even possible to also have a Windows assembly version of
these 2 things, where I left the comments? There is for
zend_mm_[high|low]_bit(), but they're very simple...
http://realplain.com/php/multiply_long.diff
http://realplain.com/php/multiply_long_5_3.diff
- Matt
----- Original Message -----
From: "Matt Wilmas"
Sent: Wednesday, November 08, 2006
> Hi,
>
> Here's an additional ZEND_SIGNED_MULTIPLY_LONG() for platforms with 32-bit
> longs that don't use the assembly version (so all Windows systems at
> least?). On my Windows system, mul_function() is 40% faster with this
> version (no overflow), which makes PHP's * operator 20% faster; with
> overflow mul_function() is 20% faster (though I don't see any difference
> with the * operator). The macro is also used in safe_emalloc()...
>
> Patch just against 5_2 as the file versions are the only difference.
>
>
> Matt