On 5/21/11, Sebastian Bergmann <[email protected]> wrote:
> On 05/20/2011 11:28 AM, Dmitry Stogov wrote:
>> The bench.php gets more than 10% speedup (2.5 sec instead of 2.9 sec)
>> Real-life applications are not affected. All the PHPT tests are passed.
>
> I chatted with Kore Nordmann, the creator of Image_3D (raytracer written
> in PHP) and ezcGraph (chart component in the Zeta Components library)
> last night. His code will definitely benefit from these improvements.
>
> Another performance improvement with regards to math functionality in
> PHP could be compiling math functions such as abs() into specialized
> opcodes thus alleviating the function call overhead that is otherwise
> incurred. Kore mentioned, for example, that Xdebug and KCacheGrind
> currently show that most time is spent in several hundred thousand calls
> to abs() while running the component's test suite.
What platform was that on? GCC already inlines its builtins by
default (even at -O0). I.e., the abs() generates the following code:
movl -4(%rbp), %eax
movl %eax, %edx
sarl $31, %edx
movl %edx, %eax
xorl -4(%rbp), %eax
subl %edx, %eax
I think it's wrong to do the md inlines in PHP itself for couple reasons:
- There's a huge list of such md functions; esp. the fp ones
would show bigger benefits. However inlining each one of them is
infeasible.
- The inlines are platform-dependent, so this would only
benefit a few platforms.
- It is generally a wrong level to do such optimizations--this
is a compiler's job.
If your profiling shows that there's a function worth a md inline and
compiler doesn't already do that, submit a bug for your compiler
vendor. (-;
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php