[Javascript] Single vs. Double quotes in Javascript

David Lovering dlovering at gazos.com
Thu Nov 13 16:41:22 CST 2003


The only conceivable difference I can imagine applying to single versus
double-quotes is if the code internals use some kind of regular expression
on parsing out the ASCII/Unicode characters which function as boundary
delimeters.  The sooner in the list the character appears, the sooner it is
recognized and the quicker the routine comes back.  Mind you, this is only a
WAG of the lowest order.

I REALLY don't think they designed one to be better than the other -- it
just happened that way.

-- Dave Lovering

----- Original Message ----- 
From: "BEKIM BACAJ" <trojani2000 at hotmail.com>
To: <javascript at LaTech.edu>
Sent: Thursday, November 13, 2003 10:48 AM
Subject: Re: [Javascript] Single vs. Double quotes in Javascript


> It is posible that single quotes have more priority than double qutoes
while
> debuged, everything inside single quotes gets procesed earlier than defs
> inside double quotes. But I doubt you can notice speed diference if the
same
> script does not use double qutese anywhere else. But if combined, single
> quted gat the precedence.
> This is, however, only my best guess.
>
> >From: "Peter-Paul Koch" <gassinaumasis at hotmail.com>
> >Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
> >To: javascript at LaTech.edu
> >Subject: Re: [Javascript] Single vs. Double quotes in Javascript
> >Date: Thu, 13 Nov 2003 16:00:14 +0000
> >
> >
> >
> >>I did not test this code to confirm or deny the 15% faster claim
> >
> >I did, and cannot confirm it. It seems that single quotes are *sometimes*
> >faster in Explorer Windows (roughly 1/3 of my tests did show a faster
> >response time), but if Mozilla shows a difference at all, it handles
double
> >quotes slightly faster. I found no difference at all in Opera.
> >
> >I cannot say that these experiments confirm the 15% claim.
> >
> >>-------
> >>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));
> >>-------
> >
> >-------------------------------------------------------------------
> >ppk, freelance web developer
> >Interaction, copywriting, JavaScript, integration
> >http://www.quirksmode.org/
> >Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
> >------------------------------------------------------------------
> >
> >_________________________________________________________________
> >The new MSN 8: smart spam protection and 2 months FREE*
> >http://join.msn.com/?page=features/junkmail
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list