Speeding question, " vs '

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

It just crossed my mind, that I usually do it like this:


instead of


The latter should be faster, as within ' nothing is replaced as in ".
I now wornder, what difference this makes in speed?
It should make some, but not really.... then again, with 10000000
users, it might.

What do you do?


Re: Speeding question, " vs '

Quoted text here. Click to load it

If it it was that important to me I'd:
1) research the issue - which is well documented
2) test it for myself

and perhaps even share my findings.


Re: Speeding question, " vs '

jodleren wrote:
Quoted text here. Click to load it

I generally use single quotes, mostly out of habit.  But the difference
is going to be negligible.  And if you have so many users that it's
overloading your system, chances are other things will contribute more
to enhancing your performance.

Don't try to prematurely optimize.  All it will do is delay your project
and give you ulcers.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Speeding question, " vs '

jodleren wrote:
Quoted text here. Click to load it

The difference is too small to care about - even with 10M Users.

I can't say whats faster because the difference is so small that if i
iterate both methods 10M times the result get corrupted by external
factors like if there are other tasks that "steal" cpu time.

 From the logical point of view single quotes should be faster because
single quotes don't support varibale substitution.

Personally i use double quotes all the time.


Re: Speeding question, " vs '

jodleren a écrit :
Quoted text here. Click to load it

I almost always use single quotes, because of those variables not
treated, if I want to include one I explicitely do it.

Almost, cause I use double quotes in SQL queries, where I use single
quote for value statements (and always use curly brackets for variables,
which makes it clearer imo to delimitate the variable names)

"INSERT INTO dummy (name) VALUES ('')"


Site Timeline