[PHP-DEV] Benchmark Suite
Hi, I invested about half an hour this morning to refactor bench.php. It now starts a new PHP process for each benchmark and uses microtime(true) and memory_get_peak_usage() to measure benchmark data. Have a look at - http://phpfi.com/208939 This is the main script. - http://phpfi.com/208937 These are the iterators used by the main script. - http://phpfi.com/208935 This code is shared between the benchmark scripts. - http://phpfi.com/208941 This is an example of a benchmark script. Here is an example output: [EMAIL PROTECTED] benchmark % php run.php Benchmark Time Peak Memory Usage ackermann 3.067452 715080 mandel 2.242472 127840 mandel2 2.185040 123448 simple 1.031363 117184 simplecall 3.849651 115528 simpleucall 4.226199 116968 simpleudcall4.394062 117176 Note that I have not yet ported all benchmarks from bench.php. At this point I would like to know whether or not people are interested in this. No point in working on this if nobody cares, right? :-) Best, Sebastian -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
On 02/27/2007 01:23 PM, Sebastian Bergmann wrote: Here is an example output: [EMAIL PROTECTED] benchmark % php run.php Benchmark Time Peak Memory Usage ackermann 3.067452 715080 mandel 2.242472 127840 mandel2 2.185040 123448 simple 1.031363 117184 simplecall 3.849651 115528 simpleucall 4.226199 116968 simpleudcall4.394062 117176 Note that I have not yet ported all benchmarks from bench.php. At this point I would like to know whether or not people are interested in this. No point in working on this if nobody cares, right? :-) I like it. Please continue. -- Wbr, Antony Dovgal -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Antony Dovgal wrote: I like it. Please continue. Okay, great. Now: where should I put it? I think the current approach of having bench.php duplicated in each branch of the Zend Engine is sub- optimal. Maybe we could create a new top-level CVS module for this? -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Sebastian Bergmann wrote: Have a look at I uploaded a snapshot of what I have now (I added fallbacks for missing functionality in PHP 4.4 and PHP 5.0 and the rest of the benchmarks) to http://static.phpunit.de/benchmark.tbz2. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
On 02/27/2007 02:42 PM, Sebastian Bergmann wrote: Antony Dovgal wrote: I like it. Please continue. Okay, great. Now: where should I put it? I think the current approach of having bench.php duplicated in each branch of the Zend Engine is sub- optimal. Maybe we could create a new top-level CVS module for this? Maybe. But separate CVS module would make sense only if we're going to release it separately. I guess qa.php.net would be a good place for such releases. Opinions? -- Wbr, Antony Dovgal -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] RE : [PHP-DEV] suggestion SplFileInfo
From: Arnold Daniels [mailto:[EMAIL PROTECTED] DirectoryIteratorRecursive: - Add flag DIRS_ONLY for the constructor, to only loop through directories This is achieved by a FilterIterator: ParentIterator Yes but if you want to loop recursively through the directories, creating an object for each file gives a huge overhead. Glob has a directory only flag, may that feature can be used. One more argument for a PHP internal implementation of glob()/fnmatch(), as GLOB_ONLYDIR is not portable (probably not posix-compliant). We could also add a flag to exclude broken symbolic links, and globbing support in stream wrappers (would allow a syntax like wget's 'ftp://dir/*'). I have written a feature request listing glob()-related problems 6 months ago (http://bugs.php.net/bug.php?id=38022). If somebody is interested, it could be time to reactivate it (unfortunately, I won't have enough free time to work on it). Regards Francois -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Hello Antony, QA sounds fine. Top-level is also fine as we have no real mathing place. When we offer it through QA we might aswell use qw-web as the cvs module but a seperate one sounds better. best regards marcus Tuesday, February 27, 2007, 5:58:41 PM, you wrote: On 02/27/2007 02:42 PM, Sebastian Bergmann wrote: Antony Dovgal wrote: I like it. Please continue. Okay, great. Now: where should I put it? I think the current approach of having bench.php duplicated in each branch of the Zend Engine is sub- optimal. Maybe we could create a new top-level CVS module for this? Maybe. But separate CVS module would make sense only if we're going to release it separately. I guess qa.php.net would be a good place for such releases. Opinions? -- Wbr, Antony Dovgal Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Hello Sebastian, looks pretty fine. Only you don't need fallbacks right now. Simply add a check for PHP = 5.2.0 since you are using Iterators and I don't see any sense in testing 5.0 or 5.1. You could further more make the run script operate a bit like run-tests.php and have the PHP executable be configurable and get version tested. So you would first check that the PHP runiing the run script is new enough and that second the tests are executed by an acceptable PHP version. When you want to spend more work, ever thought of making the bench files have a layout similar to *.phpt? So that we could split up in sections like name, actual bench, clean-up, etc? Or do you prefer to do all from within one file and call bench funcs manually? best regards marcus Tuesday, February 27, 2007, 5:53:53 PM, you wrote: Sebastian Bergmann wrote: Have a look at I uploaded a snapshot of what I have now (I added fallbacks for missing functionality in PHP 4.4 and PHP 5.0 and the rest of the benchmarks) to http://static.phpunit.de/benchmark.tbz2. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
On 02/27/2007 11:48 PM, Marcus Boerger wrote: Hello Antony, QA sounds fine. Top-level is also fine as we have no real mathing place. I meant using qa.php.net for releases, I don't care where exactly it lives in our CVS. When we offer it through QA we might aswell use qw-web as the cvs module but a seperate one sounds better. -- Wbr, Antony Dovgal -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] custom handler for specific zend_ops
Hi all. [Please, let me know if there is a better place to ask such questions.] In a Zend extension I'm working on, I need to perform some actions when certain instructions (zend_ops) are executed by the VM. Note that I'm interesting in specific instructions rather than instruction types, e.g., the first echo zend_op of a function as opposed to all echo instructions. Also, I want the handler to be invoked only when an interesting statement is executed (in other words, determining whether a zend_op is interesting must be done before execution). The way I currently do that is as follows: I override the zend_compile_file function to retrieve the zend_op_array of a file, identify the interesting statements in the array, and override their handler (the handler field in the zend_op struct) with my custom handler: The custom handler looks like this: int custom_handler(ZEND_OPCODE_HANDLE_ARGS) { // do my stuff return zend_vm_get_opcode_handler(execute_data-opline-opcode, execute_data-opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } where zend_get_opcode_handler is a copy-and-paste of the static function in zend_vm_execute.h While this seems to work (on the limited tests I've run) it also looks too hackish to be the correct way to do this ;-) So, here's the question: is there a better way to achieve the same result? I've looked at the USER_OPCODE API, but it seems to me that the API doesn't allow to specify a handler for specific zend_ops (but let me know if I'm wrong!) Thanks in advance, Marco -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] PHP 5.2.1 twice as slow?
Andrew Hutchings writes I dunno what the heck I am doing wrong then :) I have tried on a PPC running OSX, a Xen host on a Dual Xeon running Ubuntu Edgy, an EPIA running Ubuntu Edgy and the Xeon devel box. When configuring with ./configure --disable-all --disable-cgi and compiling with no additional CFLAGS on all those machines the benchmarks actually work out almost the same but in every case strcat is a lot slower on 5.2.1. I'm guessing the rest of the slowness is something to do with my configuration options. I've run the bench on a development box at work. A hefty box with no load, running Fedora Core 5. The strcat results were approximately *10 times slower* on 5.2.1 than on 5.2.0. Everything else was nominal. So I reran the bench on my dev box at home. Same deal. The overall result was close (hence my previous comments), but strcat was about 9 times slower on 5.2.1 than 5.2.0. One of my guys at work ran the bench on his Gentoo box against 5.1.16. Same deal, strcat *way* slower on 5.2.1 than 5.1.16. Best Regards Mike Robinson -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP 5.2.1 twice as slow?
I've run the bench on a development box at work. A hefty box with no load, running Fedora Core 5. The strcat results were approximately *10 times slower* on 5.2.1 than on 5.2.0. Everything else was nominal. Could you send your phpinfo() and the script you tested (or if it was bench.php from CVS then its output)? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP 5.2.1 twice as slow?
Stanislav Malyshev schrieb: The strcat results were approximately *10 times slower* on 5.2.1 than on 5.2.0. Everything else was nominal. Could you send your phpinfo() and the script you tested (or if it was bench.php from CVS then its output)? I see only tests on *nix boxes... Here is one (php.exe -n bench.php) for Windows (XP SP2) with the same result: PHP 5.2.0 (cli) simple 0.390 simplecall 0.760 simpleucall1.101 simpleudcall 1.595 mandel 1.426 mandel21.811 ackermann(7) 2.319 ary(5) 0.068 ary2(5)0.060 ary3(2000) 0.794 fibo(30) 4.673 hash1(5) 0.130 hash2(500) 0.116 heapsort(2)0.437 matrix(20) 0.497 nestedloop(12) 0.834 sieve(30) 0.486 strcat(20) 0.063 --- Total 17.562 PHP 5.2.1 (cli) simple 0.415 simplecall 0.609 simpleucall1.170 simpleudcall 1.619 mandel 1.641 mandel22.059 ackermann(7) 1.856 ary(5) 0.110 ary2(5)0.081 ary3(2000) 0.851 fibo(30) 5.253 hash1(5) 0.140 hash2(500) 0.196 heapsort(2)0.476 matrix(20) 0.322 nestedloop(12) 0.944 sieve(30) 0.327 strcat(20) 0.537 --- Total 18.605 BTW: I don't know why, but with php-cgi.exe from PHP 5.2.0, the fibo test is allways much higher then with php.exe (cli): 12.651 vs. 4.673. With the cgi from 5.2.1 there is no such difference. Hope this help. Regards, Carsten -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] PHP 5.2.1 twice as slow?
The strcat results were approximately *10 times slower* on 5.2.1 than on 5.2.0. Upping the number significantly (from 20 to 2000) smooths out abnormalities: 5.2.0: strcat(2000) 5.556 5.2.1: strcat(2000) 5.628 These results are typical for a few runs of each (fresh compiles from release tarballs with same config.nice, same system). Linux sarcasm 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux (not actually an SMP box, but stock ubuntu kernel--my laptop) bogomips: 3747.46 S -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Marcus Boerger wrote: Only you don't need fallbacks right now. Simply add a check for PHP = 5.2.0 since you are using Iterators and I don't see any sense in testing 5.0 or 5.1. Already did that yesterday. You could further more make the run script operate a bit like run-tests.php and have the PHP executable be configurable and get version tested. I am taking baby steps at the moment :) Of course the PHP binary will be configurable. When you want to spend more work, ever thought of making the bench files have a layout similar to *.phpt? So that we could split up in sections like name, actual bench, clean-up, etc? The question is: is a separate system such as mine needed or could we extend run-tests.php? If we choose to extend run-tests.php, suddenly every *.phpt test would be a potential benchmark. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Benchmark Suite
Sebastian Bergmann wrote: I uploaded a snapshot of what I have now (I added fallbacks for missing functionality in PHP 4.4 and PHP 5.0 and the rest of the benchmarks) to http://static.phpunit.de/benchmark.tbz2. I updated the snapshot. This is what the output looks like now: Benchmark Time Peak MemoryPeak Memory (Real) --- ackermann 3.050 718336 786432 array 0.104 11949880 12058624 array2 0.101 11961848 12058624 array3 1.285 648016 786432 fibonacci 14.293121936 262144 hash0.653 73474007602176 hash2 0.115 247728 262144 heapsort0.753 29411283145728 mandel 3.534 131920 262144 mandel2 2.806 124616 262144 matrix 0.703 636512 786432 nestedloop 2.844 125568 262144 sieve 0.796 25292882883584 simple 1.607 121320 262144 simplecall 5.828 119608 262144 simpleucall 6.526 121048 262144 simpleudcall6.760 121256 262144 strcat 0.117 898008 1310720 -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php