[PHP-DEV] Single quotes VS. Double quotes
This is of really low importance, but I found it interesting. A new guy on the Phorum dev team decided to convert all double quotes to single quotes for speed in CVS. The common assumption is that single quotes are faster than double quotes. However, I am of the mind set of using double always as it creates less headaches later to add a variable to the string. In an attempt to show him the marginal savings of this, I did some benchmarks. The results were confusing. $var=This is test number $x; was really slow. but, $var=This is test number .$x; and $var='This is test number '.$x; we basically identical. Andi, Zeev, if you want waste some energy on exanding on why this is and if anything in ZE2 will change it I would find it a good read. Brian Moon dealnews.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
See this : http://phpxpath.sourceforge.net/benchmark/phpBench.php And show it to the guy. Andrey - Original Message - From: Brian Moon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 6:29 PM Subject: [PHP-DEV] Single quotes VS. Double quotes This is of really low importance, but I found it interesting. A new guy on the Phorum dev team decided to convert all double quotes to single quotes for speed in CVS. The common assumption is that single quotes are faster than double quotes. However, I am of the mind set of using double always as it creates less headaches later to add a variable to the string. In an attempt to show him the marginal savings of this, I did some benchmarks. The results were confusing. $var=This is test number $x; was really slow. but, $var=This is test number .$x; and $var='This is test number '.$x; we basically identical. Andi, Zeev, if you want waste some energy on exanding on why this is and if anything in ZE2 will change it I would find it a good read. Brian Moon dealnews.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
Man, I wish that answered my question, but it does not address string concatenation vs. variables in double quoted strings anywhere on there. Thanks for trying. Brian Moon dealnews.com - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 10:35 AM Subject: Re: [PHP-DEV] Single quotes VS. Double quotes | See this : | http://phpxpath.sourceforge.net/benchmark/phpBench.php | | And show it to the guy. | | Andrey | | - Original Message - | From: Brian Moon [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Friday, December 13, 2002 6:29 PM | Subject: [PHP-DEV] Single quotes VS. Double quotes | | | This is of really low importance, but I found it interesting. A new guy | on | the Phorum dev team decided to convert all double quotes to single quotes | for speed in CVS. The common assumption is that single quotes are | faster | than double quotes. However, I am of the mind set of using double always | as | it creates less headaches later to add a variable to the string. In an | attempt to show him the marginal savings of this, I did some benchmarks. | The results were confusing. | | $var=This is test number $x; was really slow. | | but, | | $var=This is test number .$x; | | and | | $var='This is test number '.$x; | | we basically identical. | | Andi, Zeev, if you want waste some energy on exanding on why this is and | if | anything in ZE2 will change it I would find it a good read. | | Brian Moon | dealnews.com | | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
What version of php did you try this with Brian? There were some lexer changes implemented (that I believe are only in HEAD for ZE1 and ZE2 and not in 4.3) that should equalize this difference. There was a thread about this on php-dev not long ago that explains why this occurs - search the archives for ZEND_ADD_STRING. George On Friday, December 13, 2002, at 11:35 AM, Andrey Hristov wrote: See this : http://phpxpath.sourceforge.net/benchmark/phpBench.php And show it to the guy. Andrey - Original Message - From: Brian Moon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 6:29 PM Subject: [PHP-DEV] Single quotes VS. Double quotes This is of really low importance, but I found it interesting. A new guy on the Phorum dev team decided to convert all double quotes to single quotes for speed in CVS. The common assumption is that single quotes are faster than double quotes. However, I am of the mind set of using double always as it creates less headaches later to add a variable to the string. In an attempt to show him the marginal savings of this, I did some benchmarks. The results were confusing. $var=This is test number $x; was really slow. but, $var=This is test number .$x; and $var='This is test number '.$x; we basically identical. Andi, Zeev, if you want waste some energy on exanding on why this is and if anything in ZE2 will change it I would find it a good read. Brian Moon dealnews.com -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
On Fri, 13 Dec 2002, Brian Moon wrote: Man, I wish that answered my question, but it does not address string concatenation vs. variables in double quoted strings anywhere on there. This was recently fixed in PHP. Single quotes and double quotes wont have that much of a speed difference from (I believe) PHP 4.3.0. Derick - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 10:35 AM Subject: Re: [PHP-DEV] Single quotes VS. Double quotes | See this : | http://phpxpath.sourceforge.net/benchmark/phpBench.php | | And show it to the guy. | | Andrey | | - Original Message - | From: Brian Moon [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Friday, December 13, 2002 6:29 PM | Subject: [PHP-DEV] Single quotes VS. Double quotes | | | This is of really low importance, but I found it interesting. A new guy | on | the Phorum dev team decided to convert all double quotes to single quotes | for speed in CVS. The common assumption is that single quotes are | faster | than double quotes. However, I am of the mind set of using double always | as | it creates less headaches later to add a variable to the string. In an | attempt to show him the marginal savings of this, I did some benchmarks. | The results were confusing. | | $var=This is test number $x; was really slow. | | but, | | $var=This is test number .$x; | | and | | $var='This is test number '.$x; | | we basically identical. | | Andi, Zeev, if you want waste some energy on exanding on why this is and | if | anything in ZE2 will change it I would find it a good read. | | Brian Moon | dealnews.com | | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
I am using 4.2.2-dev. Must be a stable build from snaps.php.net. I will read the archives. Brian Moon dealnews.com - Original Message - From: George Schlossnagle [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 10:40 AM Subject: Re: [PHP-DEV] Single quotes VS. Double quotes | What version of php did you try this with Brian? There were some lexer | changes implemented (that I believe are only in HEAD for ZE1 and ZE2 | and not in 4.3) that should equalize this difference. There was a | thread about this on php-dev not long ago that explains why this occurs | - search the archives for ZEND_ADD_STRING. | | George | | On Friday, December 13, 2002, at 11:35 AM, Andrey Hristov wrote: | | See this : | http://phpxpath.sourceforge.net/benchmark/phpBench.php | | And show it to the guy. | | Andrey | | - Original Message - | From: Brian Moon [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Friday, December 13, 2002 6:29 PM | Subject: [PHP-DEV] Single quotes VS. Double quotes | | | This is of really low importance, but I found it interesting. A new | guy | on | the Phorum dev team decided to convert all double quotes to single | quotes | for speed in CVS. The common assumption is that single quotes are | faster | than double quotes. However, I am of the mind set of using double | always | as | it creates less headaches later to add a variable to the string. In | an | attempt to show him the marginal savings of this, I did some | benchmarks. | The results were confusing. | | $var=This is test number $x; was really slow. | | but, | | $var=This is test number .$x; | | and | | $var='This is test number '.$x; | | we basically identical. | | Andi, Zeev, if you want waste some energy on exanding on why this is | and | if | anything in ZE2 will change it I would find it a good read. | | Brian Moon | dealnews.com | | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
Oops, contrary to my earlier statement, the lexer patch for this problem seems to be in 4.3.0rc2 and 4.3.0rc3. George On Friday, December 13, 2002, at 11:43 AM, Brian Moon wrote: I am using 4.2.2-dev. Must be a stable build from snaps.php.net. I will read the archives. Brian Moon dealnews.com - Original Message - From: George Schlossnagle [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Brian Moon [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 13, 2002 10:40 AM Subject: Re: [PHP-DEV] Single quotes VS. Double quotes | What version of php did you try this with Brian? There were some lexer | changes implemented (that I believe are only in HEAD for ZE1 and ZE2 | and not in 4.3) that should equalize this difference. There was a | thread about this on php-dev not long ago that explains why this occurs | - search the archives for ZEND_ADD_STRING. | | George | | On Friday, December 13, 2002, at 11:35 AM, Andrey Hristov wrote: | | See this : | http://phpxpath.sourceforge.net/benchmark/phpBench.php | | And show it to the guy. | | Andrey | | - Original Message - | From: Brian Moon [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Sent: Friday, December 13, 2002 6:29 PM | Subject: [PHP-DEV] Single quotes VS. Double quotes | | | This is of really low importance, but I found it interesting. A new | guy | on | the Phorum dev team decided to convert all double quotes to single | quotes | for speed in CVS. The common assumption is that single quotes are | faster | than double quotes. However, I am of the mind set of using double | always | as | it creates less headaches later to add a variable to the string. In | an | attempt to show him the marginal savings of this, I did some | benchmarks. | The results were confusing. | | $var=This is test number $x; was really slow. | | but, | | $var=This is test number .$x; | | and | | $var='This is test number '.$x; | | we basically identical. | | Andi, Zeev, if you want waste some energy on exanding on why this is | and | if | anything in ZE2 will change it I would find it a good read. | | Brian Moon | dealnews.com | | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- | PHP Development Mailing List http://www.php.net/ | To unsubscribe, visit: http://www.php.net/unsub.php | | | | -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Single quotes VS. Double quotes
Brian Moon [EMAIL PROTECTED] wrote... : This is of really low importance, but I found it interesting. A new guy on the Phorum dev team decided to convert all double quotes to single quotes for speed in CVS. The common assumption is that single quotes are faster than double quotes. However, I am of the mind set of using double always as it creates less headaches later to add a variable to the string. In an attempt to show him the marginal savings of this, I did some benchmarks. The results were confusing. $var=This is test number $x; was really slow. but, $var=This is test number .$x; and $var='This is test number '.$x; we basically identical. Andi, Zeev, if you want waste some energy on exanding on why this is and if anything in ZE2 will change it I would find it a good read. Actually, I've benchmarked this long time ago on v4.0.x and my results were completely meaningless. Don't remember right now, but I guess I ended up believing that both parsing's (a dot in single and a variable in double) were having their own tiny delays with minimal difference. Only non-concatenated strings were resulting faster for some miserable particle of a millisecond with single quotes (what, seems to be optimized/normalized in PHP v4.3.0). Whatever the result is, even with thousands loops, the speed gained by optimizing concatenations will generally be times less than the overall execution of the script that uses so many strings - it's proportional. IMHO, the only reasons to care about this are the code readability and coding standards within a team. If that makes sense to be so much restrictive. -- Maxim Maletsky [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php