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
Nice patch! Looks good to me... Any other thoughts?
-----Original Message-----
From: Matt Wilmas [mailto:php_lists@realplain.com]
Sent: Wednesday, November 08, 2006 8:47 PM
To: internals@lists.php.net
Subject: [PHP-DEV] Optimization for ..._MULTIPLY_LONG on more systemsHi,
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
Matt,
Looks like a good patch to me.
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
<multiply_long.txt>
Ilia Alshanetsky
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
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
any takers for this patch?
otherwise it will probably not make the cut by the 24th
regards,
Lukas Kahwe Smith
mls@pooteeweet.org