Hi Guys,
I was reading an article and one question come into my mind...
I know that rails view helpers, like: form_for, select_tag, makes the HTML
code automatically.
But at the performance view, is it a good idea?.
I mean, using this kind of helpers will include some "server-side" calls.
My question is:
Is a good Idea use this kind of helpers or create HTML code by myself?

Thx.
Bruno Meira

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Walter Lee Davis at Jan 16, 2012 at 7:44 pm

    On Jan 16, 2012, at 2:03 PM, Bruno Meira wrote:

    Hi Guys,
    I was reading an article and one question come into my mind...
    I know that rails view helpers, like: form_for, select_tag, makes the HTML code automatically.
    But at the performance view, is it a good idea?.
    I mean, using this kind of helpers will include some "server-side" calls.
    My question is:
    Is a good Idea use this kind of helpers or create HTML code by myself?
    Helpers keep everything following the rules. You don't have to figure out what the ID should be or what the field name should be, the helper makes it all perfectly uniform and keeps it what the controller expects.

    As far as I know, there is no penalty for this, except maybe at application start time, when all of these view helpers are compiled and concatenated once and for all.

    Walter
    Thx.
    Bruno Meira



    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Bruno Meira at Jan 16, 2012 at 8:02 pm
    Thx for your reply Walber. :D
    That's exactly the point that is my question.
    The helper will be constructed at view time, isn't it?
    If it was at application start time, how ruby syntaxes that involves
    iteration will works?
    .....
    Example:
    @users.each do |user|
    f.select_tag ...
    .....

    Well, I'm not so sure that these helpers will be work without an overhead.
    For now, I think that helpers are good just as a start version of your app,
    after you have to change your view to work with as less erb as you can.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Bruno Meira at Jan 16, 2012 at 8:07 pm
    *Walter

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Walter Lee Davis at Jan 16, 2012 at 8:14 pm

    On Jan 16, 2012, at 3:01 PM, Bruno Meira wrote:

    Thx for your reply Walber. :D
    That's exactly the point that is my question.
    The helper will be constructed at view time, isn't it?
    If it was at application start time, how ruby syntaxes that involves iteration will works?
    .....
    Example:
    @users.each do |user|
    f.select_tag ...
    .....

    Well, I'm not so sure that these helpers will be work without an overhead.
    For now, I think that helpers are good just as a start version of your app, after you have to change your view to work with as less erb as you can.

    If you can pinpoint the erb as a source of overhead in your performance testing, then certainly, have at it. But while you are designing and iterating your application, hand-coding the views is a source of developer overhead that you really need to balance against theoretical maximum application performance. (Even if you don't pay your developers anything at all, it still takes time to make the changes, and the thought of that effort is a chilling effect on your willingness to try new things.)

    Walter


    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Jan 16, 2012 at 9:21 pm

    On 16 January 2012 19:03, Bruno Meira wrote:
    Hi Guys,
    I was reading an article and one question come into my mind...
    I know that rails view helpers, like: form_for, select_tag, makes the HTML
    code automatically.
    But at the performance view, is it a good idea?.
    I mean, using this kind of helpers will include some "server-side" calls.
    My question is:
    Is a good Idea use this kind of helpers or create HTML code by myself?
    The processor time required to evaluate such helpers is absolutely
    trivial compared to other server side operations such as querying the
    database and handling requests and responses

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Bruno Meira at Jan 16, 2012 at 9:25 pm
    Thx Guys,
    I understand.
    Well, as I see this overload is small compared with the benefits of using
    these helpers.
    :D

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 16, '12 at 7:04p
activeJan 16, '12 at 9:25p
posts7
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase