[nodejs] res.setHeader is so slow

140 views
Skip to first unread message

jason.桂林

unread,
Jun 15, 2012, 3:14:35 AM6/15/12
to nod...@googlegroups.com
I found writeHead is much faster if there is no setHeader before.


--
Best regards,

桂林 (Gui Lin)


Tim Dickinson

unread,
Jun 15, 2012, 5:02:02 PM6/15/12
to nod...@googlegroups.com
Take a look at the source code and it will give you an idea.

Isaac Schlueter

unread,
Jun 15, 2012, 11:38:37 PM6/15/12
to nod...@googlegroups.com
Yeah, you can't mix and match them very well. We should probably
print a warning or something in that case, or just pick one API and
deprecate the other.
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

Tom

unread,
Jun 16, 2012, 4:09:22 AM6/16/12
to nod...@googlegroups.com
+1 for pick one API and deprecate the other. Having multiple APIs do the same thing only causes confusion.

Tom

Op zaterdag 16 juni 2012 05:38:37 UTC+2 schreef Isaac Schlueter het volgende:
Yeah, you can't mix and match them very well.  We should probably
print a warning or something in that case, or just pick one API and
deprecate the other.

On Fri, Jun 15, 2012 at 2:02 PM, Tim Dickinson <price...@gmail.com> wrote:
> Take a look at the source code and it will give you an idea.
> https://github.com/joyent/node/blob/master/lib/http.js#L949
>
>
> On Friday, June 15, 2012 3:14:35 AM UTC-4, Jason.桂林(Gui Lin) wrote:
>>
>> I found writeHead is much faster if there is no setHeader before.
>>
>>
>> --
>> Best regards,
>>
>> 桂林 (Gui Lin)
>>
>> guileen@twitter
>> 桂糊涂@weibo
>> guileen@github
>>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to

tjholowaychuk

unread,
Jun 16, 2012, 11:52:19 AM6/16/12
to nodejs
writeHead is pretty useless. setHeader with an array is also a bad API
IMHO, if I want to set a few cookies in an app they most likely wont
be set together in the same block of code, this is why Connect patches
setHeader to give it a progressive API

On Jun 16, 1:09 am, Tom <tommed...@gmail.com> wrote:
> +1 for pick one API and deprecate the other. Having multiple APIs do the
> same thing only causes confusion.
>
> Tom
>
> Op zaterdag 16 juni 2012 05:38:37 UTC+2 schreef Isaac Schlueter het
> volgende:
>
>
>
>
>
>
>
>
>
> > Yeah, you can't mix and match them very well.  We should probably
> > print a warning or something in that case, or just pick one API and
> > deprecate the other.
>
> > On Fri, Jun 15, 2012 at 2:02 PM, Tim Dickinson <price.ti...@gmail.com>
> > wrote:
> > > Take a look at the source code and it will give you an idea.
> > >https://github.com/joyent/node/blob/master/lib/http.js#L949
>
> > > On Friday, June 15, 2012 3:14:35 AM UTC-4, Jason.桂林(Gui Lin) wrote:
>
> > >> I found writeHead is much faster if there is no setHeader before.
>
> > >> --
> > >> Best regards,
>
> > >> 桂林 (Gui Lin)
>
> > >> guileen@twitter
> > >> 桂糊涂@weibo
> > >> guileen@github
>
> > > --
> > > Job Board:http://jobs.nodejs.org/
> > > Posting guidelines:
> > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > You received this message because you are subscribed to the Google
> > > Groups "nodejs" group.
> > > To post to this group, send email to nod...@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > nodejs+un...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages