[Javascript] Single vs. Double quotes in Javascript

Håkan Magnusson hakan at backbase.com
Thu Nov 13 09:42:15 CST 2003


DHTML attributes?
It proves that string operations with single quoted strings are faster
than with double quoted strings, exactly what I initially claimed.


Mike Dougherty wrote:

> I did not test this code to confirm or deny the 15% faster claim
> 
> How does this test prove performance on access to single- vs.
> double-quoted dhtml attributes?
> 
> (unless I missed the original point)
> 
> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Håkan Magnusson
> Sent: Thursday, November 13, 2003 10:24 AM
> To: [JavaScript List]
> Subject: Re: [Javascript] How to dim buttons
> 
> 
> Well, it's not a *billion* times faster, but this little simple test 
> case proves it to be at least 15% faster.
> 
> -------
> var s='';
> var iTime1 = new Date().valueOf();
> for(var i=0;i<100000;i++){
> 	s+="a";
> }
> var iTime2 = new Date().valueOf();
> alert('With double quote : ' + (iTime2 - iTime1));
> 
> 
> s='';
> iTime1 = new Date().valueOf();
> for(var i=0;i<100000;i++){
> 	s+='a';
> }
> iTime2 = new Date().valueOf();
> alert('With single quote : ' + (iTime2 - iTime1));
> -------
> 
> So no, I wasn't talking about Perl, I was talking about JavaScript, 
> where there IS a difference.
> 
> 
> Tim Makins wrote:
> 
>>Perhaps the person is getting mixed up with Perl, where there IS a
>>difference :
>>http://perl.about.com/library/weekly/aa052900a.htm
>>
>>Tim in Ireland.
>>
>>
>>----- Original Message -----
>>From: "Peter Brunone" <peter at brunone.com>
>>
>>>*I* still want to know why someone claimed that single quotes
>>>parse a million times faster than double quotes.
>>>
>>>-Peter
>>
>>
>>
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>.
>>
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> .
> 





More information about the Javascript mailing list