Performance wise whats better?

Discussion in 'ASP .Net Building Controls' started by Showjumper, Mar 3, 2005.

  1. Showjumper

    Showjumper Guest

    With respect to performance, whats better - using the the utility methods of
    HtmlTextWriter to render the control or to use
    Dim inputa As New TextBox
    Dim butt As New Button
    inputa.RenderControl(wr)
    butt.RenderControl(wr)


    As i understand it direct render via the utility methods is better because
    there is not extra overhead but does it really make that much of a
    difference?

    Thanks Ashok
     
    Showjumper, Mar 3, 2005
    #1
    1. Advertising

  2. The HTMLTextWriter methods will usually offer slightly better performance.
    However, creating web controls manually (as in your example) is usually more
    efficient with your development time, and it's also less bug-prone because
    the standard web controls have already been through rigorous testing.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Showjumper" <> wrote in message
    news:...
    > With respect to performance, whats better - using the the utility methods
    > of
    > HtmlTextWriter to render the control or to use
    > Dim inputa As New TextBox
    > Dim butt As New Button
    > inputa.RenderControl(wr)
    > butt.RenderControl(wr)
    >
    >
    > As i understand it direct render via the utility methods is better because
    > there is not extra overhead but does it really make that much of a
    > difference?
    >
    > Thanks Ashok
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Mar 3, 2005
    #2
    1. Advertising

  3. Showjumper

    Showjumper Guest

    Up till know i have made controls by making composite controls using
    controls.add(thenamegoeshere) and calling renderchildren. Is creating them
    manually in the render routine essentially the same as using the
    controls.add method in a composite control and calling renderchildren and
    does it also incur the hit compsotie controls incur?

    Thanks Ashok...
    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:...
    > The HTMLTextWriter methods will usually offer slightly better performance.
    > However, creating web controls manually (as in your example) is usually

    more
    > efficient with your development time, and it's also less bug-prone because
    > the standard web controls have already been through rigorous testing.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "Showjumper" <> wrote in message
    > news:...
    > > With respect to performance, whats better - using the the utility

    methods
    > > of
    > > HtmlTextWriter to render the control or to use
    > > Dim inputa As New TextBox
    > > Dim butt As New Button
    > > inputa.RenderControl(wr)
    > > butt.RenderControl(wr)
    > >
    > >
    > > As i understand it direct render via the utility methods is better

    because
    > > there is not extra overhead but does it really make that much of a
    > > difference?
    > >
    > > Thanks Ashok
    > >
    > >
    > >

    >
    >
    >
     
    Showjumper, Mar 3, 2005
    #3
  4. Either way you're creating the same number of controls so there should be no
    significant performance difference.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Showjumper" <> wrote in message
    news:ey26%...
    > Up till know i have made controls by making composite controls using
    > controls.add(thenamegoeshere) and calling renderchildren. Is creating them
    > manually in the render routine essentially the same as using the
    > controls.add method in a composite control and calling renderchildren and
    > does it also incur the hit compsotie controls incur?
    >
    > Thanks Ashok...
    > "Steve C. Orr [MVP, MCSD]" <> wrote in message
    > news:...
    >> The HTMLTextWriter methods will usually offer slightly better
    >> performance.
    >> However, creating web controls manually (as in your example) is usually

    > more
    >> efficient with your development time, and it's also less bug-prone
    >> because
    >> the standard web controls have already been through rigorous testing.
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr, MCSD, MVP
    >> http://SteveOrr.net
    >>
    >>
    >> "Showjumper" <> wrote in message
    >> news:...
    >> > With respect to performance, whats better - using the the utility

    > methods
    >> > of
    >> > HtmlTextWriter to render the control or to use
    >> > Dim inputa As New TextBox
    >> > Dim butt As New Button
    >> > inputa.RenderControl(wr)
    >> > butt.RenderControl(wr)
    >> >
    >> >
    >> > As i understand it direct render via the utility methods is better

    > because
    >> > there is not extra overhead but does it really make that much of a
    >> > difference?
    >> >
    >> > Thanks Ashok
    >> >
    >> >
    >> >

    >>
    >>
    >>

    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Mar 3, 2005
    #4
  5. Showjumper

    Guest

    An alternative that may result in less code is doing something like
    using a LiteralControl or a HtmlGenericControl("div") and adding all of
    your controls to this container. Then call
    ThisContainer.RenderControl(mywriter);

    I usually use a WholeContainer which is a div that I have specially
    styled and I add all my child control's for a web control to this.
     
    , Mar 5, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rogue Chameleon
    Replies:
    16
    Views:
    577
    Gerbrand van Dieijen
    Nov 26, 2004
  2. Fred
    Replies:
    12
    Views:
    1,725
    Sandeep
    Oct 31, 2003
  3. Enrique Cruiz

    Row-wise vs. column-wise image processing

    Enrique Cruiz, Jan 25, 2007, in forum: C Programming
    Replies:
    10
    Views:
    724
    christian.bau
    Jan 26, 2007
  4. Enrique Cruiz
    Replies:
    5
    Views:
    421
    Jim Langston
    Jan 25, 2007
  5. Joey Martin
    Replies:
    28
    Views:
    276
    Bob Barrows [MVP]
    Jun 25, 2008
Loading...

Share This Page