Speeding question, " vs '

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jodleren

    Speeding question, " vs '

    Hi!

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

    $whatver=$_POST["returned_value "];

    instead of

    $whatver=$_POST['returned_value '];

    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?

    WBR
    Sonnich
  • C. (http://symcbean.blogspot.com/)

    #2
    Re: Speeding question, " vs '

    On 30 Apr, 13:08, jodleren <sonn...@hot.ee wrote:
    Hi!
    >
    It just crossed my mind, that I usually do it like this:
    >
    $whatver=$_POST["returned_value "];
    >
    instead of
    >
    $whatver=$_POST['returned_value '];
    >
    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?

    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.

    C.

    Comment

    • Joe Scylla

      #3
      Re: Speeding question, &quot; vs '

      jodleren wrote:
      Hi!
      >
      It just crossed my mind, that I usually do it like this:
      >
      $whatver=$_POST["returned_value "];
      >
      instead of
      >
      $whatver=$_POST['returned_value '];
      >
      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?
      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.

      Joe

      Comment

      • Jerry Stuckle

        #4
        Re: Speeding question, &quot; vs '

        jodleren wrote:
        Hi!
        >
        It just crossed my mind, that I usually do it like this:
        >
        $whatver=$_POST["returned_value "];
        >
        instead of
        >
        $whatver=$_POST['returned_value '];
        >
        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?
        >
        WBR
        Sonnich
        >
        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.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Guillaume

          #5
          Re: Speeding question, &quot; vs '

          jodleren a écrit :
          What do you do?
          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 ('{$name}')"

          Regards,
          --
          Guillaume

          Comment

          Working...