RE: [PHP-DEV] messing with branch prediction
| From: | Zeev Suraski | Date: | Tue, 20 Jun 2006 22:24:12 +0000 |
| Subject: | RE: [PHP-DEV] messing with branch prediction | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24164@lists.php.net to get a copy of this message | ||
Well, as I said I think it actually makes the code more readable, by hinting you what you can ignore if you're running through the 'common case' (i.e., even if this macro was a no-op). Diving into a big block of code is easier if you can ignore parts of it to get the general understanding of what it does. And if we might get some performance boost out of it, that's even better.
It boils down to whether the people who are actively hacking on the engine code today feel that it's really making the code less readable, or the other way around. It's not such a big deal either way.
Zeev
At 18:00 20/06/2006, Andi Gutmans wrote:
The source code is already hard to maintain. I think the more macros, uncommon and compiler specific things we have in there, the harder it will get. That's why I think that if it doesn't give much benefit it actually hurts to have it in because maintenance keeps on getting harder. Again, I think it's a cool effort by Nuno and I'll be interested to watch more fine-tuned results but I've been down this patch and it seems the CPUs do their work fairly OK. -----Original Message----- From: Zeev Suraski [mailto:zeev@zend.com] Sent: Tuesday, June 20, 2006 7:17 AM To: Andi Gutmans Cc: 'Nuno Lopes'; 'PHPdev' Subject: RE: [PHP-DEV] messing with branch prediction I still don't see how it can hurt, and even if it doesn't do anything performance wise, it adds clarity to the code. Zeev At 20:34 19/06/2006, Andi Gutmans wrote:point. ItI think it's a nice idea but I doubt it's very useful at thisinline withdoesn't seem to significantly affect performance, which isa significant way.some tests that we have done in the past, where it's really the hardware management of branch prediction and cache size which affect this. I doubt that make such code changes will affect that inhoping that theWe are playing around with some memory management issues, and are relying on some hardware branch predicition there (i.e.improvement withinhardware will play nice with if() statements that always evaluate the same). It seems that the hardware is playing pretty nice with us.-----Original Message----- From: Zeev Suraski [mailto:zeev@zend.com] Sent: Monday, June 19, 2006 12:46 AM To: Nuno Lopes Cc: PHPdev Subject: Re: [PHP-DEV] messing with branch prediction Definitely looks nice. I actually like how it makes the code more readable hinting which branches are rare. Zeev At 16:49 18/06/2006, Nuno Lopes wrote:executor.Hello, Yesterday I was playing with branch prediction in the Zend VMAlthough I didn't have any noticeable performanceunsubscribe,someone elsethe bench.php script, I've put the patch on-line, becauset_005f_00might want to mess with it too :) (but with care..) patch: http://mega.ist.utl.pt/~ncpl/zend_branch_prediction.txt gcc docs: http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-g_increase. On CPUs5fbuiltin_005fexpect-2440 the zend.h part of the patch is based on the similar macros (with the same name, too) found in the Linux kernel. I made & tested the patch in a Centrino laptop with gcc 3.4, so it might be the cause of getting no relevant performancewith longer pipelines (like Pentium 4/NetBurst architecture), the performance increase might be noticeable. Happy hacking :) Nuno -- PHP Internals - PHP Runtime Development Mailing List Tounsubscribe,-- PHP Internals - PHP Runtime Development Mailing List Tovisit: http://www.php.net/unsub.phpvisit: http://www.php.net/unsub.php