Is there a performance penalty when using double quotes / single quotes

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a performance penalty when using double quotes / single quotes

marcopas
Hi there

i was wondering if there is a performance penalty when using double
qoutes instead of single qoutes in my GSP or Controllers when there is
no need for GStrings?

So is there a performance difference in using:

Controller:
- redirect(action: "list")
compared to
- redirect(action: 'list')

or

GSP page:
- <g:link action="create" controller="contact">create contact</g:link>
compared to
- <g:link action='create' controller='contact'>create contact</g:link>

Greetings Marco

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Is there a performance penalty when using double quotes / single quotes

Ian Roberts
On 06/12/2010 09:05, Marco Pas wrote:
> Hi there
>
> i was wondering if there is a performance penalty when using double
> qoutes instead of single qoutes in my GSP or Controllers when there is
> no need for GStrings?

There shouldn't be, I believe the Groovy compiler turns a double quoted
literal into a String rather than a GString if it doesn't contain any
dollar replacements.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Is there a performance penalty when using double quotes / single quotes

pledbrook
>> i was wondering if there is a performance penalty when using double
>> qoutes instead of single qoutes in my GSP or Controllers when there is
>> no need for GStrings?
>
> There shouldn't be, I believe the Groovy compiler turns a double quoted
> literal into a String rather than a GString if it doesn't contain any
> dollar replacements.

Correct.

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Is there a performance penalty when using double quotes / single quotes

marcopas
Perfect, than i do not have to worry about the qoutes! Thanks for the
quick answer.

Greetings marco

2010/12/6 Peter Ledbrook <[hidden email]>:

>>> i was wondering if there is a performance penalty when using double
>>> qoutes instead of single qoutes in my GSP or Controllers when there is
>>> no need for GStrings?
>>
>> There shouldn't be, I believe the Groovy compiler turns a double quoted
>> literal into a String rather than a GString if it doesn't contain any
>> dollar replacements.
>
> Correct.
>
> --
> Peter Ledbrook
> Grails Advocate
> SpringSource - A Division of VMware
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Is there a performance penalty when using double quotes / single quotes

johnrellis
You don't want to use GStrings as Map keys though as a rule of thumb, something to do with the hashcode i think.

I think codenarc will catch this oversight.

John

On Mon, Dec 6, 2010 at 12:35 PM, Marco Pas <[hidden email]> wrote:
Perfect, than i do not have to worry about the qoutes! Thanks for the
quick answer.

Greetings marco

2010/12/6 Peter Ledbrook <[hidden email]>:
>>> i was wondering if there is a performance penalty when using double
>>> qoutes instead of single qoutes in my GSP or Controllers when there is
>>> no need for GStrings?
>>
>> There shouldn't be, I believe the Groovy compiler turns a double quoted
>> literal into a String rather than a GString if it doesn't contain any
>> dollar replacements.
>
> Correct.
>
> --
> Peter Ledbrook
> Grails Advocate
> SpringSource - A Division of VMware
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
John Rellis
@johnrellis

Reply | Threaded
Open this post in threaded view
|

Re: Is there a performance penalty when using double quotes / single quotes

John Fletcher-3
In reply to this post by marcopas
But typing single quotes requires only 50% of the resources required to type double quotes.

2010/12/6 Marco Pas <[hidden email]>
Perfect, than i do not have to worry about the qoutes! Thanks for the
quick answer.

Greetings marco

2010/12/6 Peter Ledbrook <[hidden email]>:
>>> i was wondering if there is a performance penalty when using double
>>> qoutes instead of single qoutes in my GSP or Controllers when there is
>>> no need for GStrings?
>>
>> There shouldn't be, I believe the Groovy compiler turns a double quoted
>> literal into a String rather than a GString if it doesn't contain any
>> dollar replacements.
>
> Correct.
>
> --
> Peter Ledbrook
> Grails Advocate
> SpringSource - A Division of VMware
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email