Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Calling performance geeks
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
11 24th May 17:36
nlopess
External User
 
Posts: 1
Default Calling performance geeks



The difference is probably due to the big cache that Centrino has. So the
problem with AMD can be a high number of cache-misses. Try to compile with a
recent compiler (aka gcc 4) with -Os, to see if it improves.
I do also think that the Zend Engine may be inlining too many functions. The
kernel guys are currently de-inlining many functions, to let the compiler
choose itself which functions to inline (gcc 4/4.1 will supposedly do a good
work).

Nuno


----- Original Message -----
From: "Dmitry Stogov" <dmitry@zend.com>
To: "'Rasmus Lerdorf'" <rasmus@lerdorf.com>; "'internals'"
<internals@lists.php.net>
Sent: Monday, March 13, 2006 12:12 PM
Subject: RE: [PHP-DEV] Calling performance geeks


Hi Rasmus,

I made two improvements in 5.1 and run the same bechmarks on Intel Pentium M
1.5GHz 2M cache.

top/top5/top10

php-5.1 740 550 430 req/sec
php-4.4 680 440 290 req/sec

May be the problem is AMD chip?

Thanks. Dmitry.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote


  sponsored links


12 24th May 17:36
helly
External User
 
Posts: 1
Default Calling performance geeks



Hello Dmitry,

if you mean the hash stuff you changed then you did quite some mistakes.
Because the normal apply functions don't respect the ZEND_HASH_* consts as
i mailed last week.

marcus


Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
13 24th May 17:36
rasmus
External User
 
Posts: 1
Default Calling performance geeks


Yup, that patch helped. And I guess on some architectures 5.1 is faster
now, but there is still a bit of a gap, at least on this Linux box I am
testing on:

http://www.php.net/~rasmus/bm2.png

The 5.1.3m version there is one where I got rid of the
ap_add_common_vars() and ap_add_cgi_vars() calls in
sapi/apache_mod_php5.c just to see how much it would help. On the empty
case which is all about start/shutdown, it had the expected effect, but
as we do more in the request the effect disappears.

-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
14 24th May 17:36
r.korving
External User
 
Posts: 1
Default Calling performance geeks


Hi,

If you're even interested in the tinyest of optimizations, you may wanna
read this. I was just going through the php code. I'm not familiar with it
at all, so I don't know which functions are the bottlenecks, so I can't help
in optimizing the big picture. But I had little else to do right now, so I
figured I'd just browse around through the files to see if I could notice
any local speedups. So really, the things I lay out here are probably
futile, but who knows.


-----

I found that for example the function php_stream_memory_seek() in
main/streams/memory.c contains a whole bunch of return statements. I found
that it can be (you can benchmark this) slightly faster to do this:

int func(int p)
{
int result = 0;

switch (p)
{
case 0: result = 1; break;
case 1: result = -4; break;
case 2: result = 15; break;
}
return result;
}

instead of this:

int func(int p)
{
switch (p)
{
case 0: return 1;
case 1: return -4;
case 2: return 15;
}
return 0;
}

This is correct with 'gcc foo.c' as well as with 'gcc -O2 foo.c'. The
difference is slight, and if it's too tiny, just ignore it this message.

Perhaps some functions that php relies on heavily may benefit from this
though (but I wouldn't know which ones those would be).

-----

Also, I noticed that in php_start_ob_buffer() in main/output.c, and probably
in more functions integers are divided by 2 by doing:
result = intvar / 2;
while it is about 20% faster (even with -O2) to do this:
result = intvar >> 1;

-----

A minor thing I noticed (nothing to speed up here though) is an unused
variable 'i' in insertionsort() in main/mergesort.c (weird that this never
showed up as a compiler warning). Or does the defined TSRMLS_CC depend on
the existance of an integer called 'i'? Pretty unlikely to me.

-----

Why is CONTEXT_TYPE_IMAGE_GIF in main/logos.h defined as "Content-Type:
image/gif" with 2 spaces between "Content-Type" and "image/gif"?

-----

In sapi/apache/mod_php5.c in the function php_apache_log_message(),

Why are these 2 calls:

fprintf(stderr, "%s", message);
fprintf(stderr, "\n");

instead of 1 call:

fprintf(stderr, "%s\n", message);

-----

In sapi/apache/mod_php5.c in the function php_apache_flag_handler_ex(),

the original:
if (!strcasecmp(arg2, "On") || (arg2[0] == '1' && arg2[1] == '\0')) {
bool_val[0] = '1';
} else {
bool_val[0] = '0';
}

is over 5 times slower than:

if (((arg2[0] == 'O' || arg2[0] == 'o') && (arg2[1] == 'n' || arg2[1] ==
'N') && (arg2[2] == '\0')) || (arg2[0] == '1' && arg2[1] == '\0')) {
bool_val[0] = '1';
} else {
bool_val[0] = '0';
}

-----


Like I said, these are extremely tiny things, so please ignore it if it's
too futile Nonetheless, if this turns out to be appreciated information,
I'll continue the hunt.

Good luck optimizing,

Ron

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
15 24th May 17:36
helly
External User
 
Posts: 1
Default Calling performance geeks


Hello Ron,

that stuff is only used in edgcases however it is more of a fix than an
optimization. Do you have access and want to do the changes yourself?

regards
marcus


Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
16 24th May 17:36
r.korving
External User
 
Posts: 1
Default Calling performance geeks


Hi,

I don't have access and I don't need to do the changes myself, but if you
prefer it, I will (provided I get access of course).

Ron


from


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
17 24th May 17:37
helly
External User
 
Posts: 1
Default Calling performance geeks


Hello Ron,

just as a clarification, you looked at unchanged 4.4 code that is fixed
since long in 5.1/HEAD. Please always first look into 5.1/HEAD since 4.4
will only get real fixes but no code beautifying. Also we always start to
modify HEAD first and MFH from there. Doing it the otherway round just
costs unneccessary development time.


Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
18 24th May 17:37
r.korving
External User
 
Posts: 1
Default Calling performance geeks


Hi Marcus,

Actually, I was looking at the 5.1.2, not 4.4. And 5.1.2 can't differ that
much from 5.1/HEAD, right? I'm not sure if I'm ready for CVS access, since I
don't know enough of the architecture of the system as a whole. I wouldn't
wanna break anything while trying to make things better. If I wanna
collaborate, what's the protocol of applying for a CVS account and is there
info on quality assurance? Are all CVS changes reviewed? I'd like to know
how this works, but don't quite know where to begin. Can you provide me some
basic info to get me informed and possibly get me started?

Thanks,

Ron


from


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
19 24th May 21:17
helly
External User
 
Posts: 1
Default Calling performance geeks


Hello Ron,

i was under the impression you were already contributing to one of the
extensions. And well 5.1.2 obviously differs pretty much from 5.1.3 right
now especially in that file. To apply for a cvs account you'd first send
in some patches and mostly you would do that for a certain extension or
area. After a few reviews you'd go to the webpage, fill out a form and
get an approval. That we all did.

best regards
marcus

Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
20 24th May 21:17
andi
External User
 
Posts: 1
Default Calling performance geeks


This one isn't a good idea. I bet it won't affect overal performance
but makes the code much less maintainable.
The others look OK (just took a quick glance)


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666