Best practices for cookies in classic ASP - memory usage

Best practices for cookies in classic ASP - memory usage

am 30.05.2007 14:53:34 von MartyNg

When using cookies in classic asp, is it safe to assume that using a
comma delimited list of values in one cookie is much more efficient
than using multiple cookies? (example below)

Response.Cookies("someCookie") = "101,102,103,104,105,106"
If InStr(Request.Cookies("someCookie"),"103") > 0 Then.......

vs.

Response.Cookies("101") = "True"
Response.Cookies("102") = "True"
Response.Cookies("103") = "True"
Response.Cookies("104") = "True"
Response.Cookies("105") = "True"
Response.Cookies("106") = "True"
If Request.Cookies("103") = "True" Then.....


Thank you!

Re: Best practices for cookies in classic ASP - memory usage

am 30.05.2007 15:52:09 von Anthony Jones

"MartyN" wrote in message
news:1180529614.119866.280390@k79g2000hse.googlegroups.com.. .
> When using cookies in classic asp, is it safe to assume that using a
> comma delimited list of values in one cookie is much more efficient
> than using multiple cookies? (example below)
>
> Response.Cookies("someCookie") = "101,102,103,104,105,106"
> If InStr(Request.Cookies("someCookie"),"103") > 0 Then.......
>
> vs.
>
> Response.Cookies("101") = "True"
> Response.Cookies("102") = "True"
> Response.Cookies("103") = "True"
> Response.Cookies("104") = "True"
> Response.Cookies("105") = "True"
> Response.Cookies("106") = "True"
> If Request.Cookies("103") = "True" Then.....
>
>
> Thank you!
>

The former is more effecient than the latter. Whether it is 'much' more
effecient depends on the real world usage but creating multiple cookies will
increase the size the requests being made to the server.

Re: Best practices for cookies in classic ASP - memory usage

am 30.05.2007 20:44:29 von Egbert Nierop

"Anthony Jones" schreef in bericht
news:O9nx6GsoHHA.4424@TK2MSFTNGP03.phx.gbl...
>
> "MartyN" wrote in message
> news:1180529614.119866.280390@k79g2000hse.googlegroups.com.. .
>> When using cookies in classic asp, is it safe to assume that using a
>> comma delimited list of values in one cookie is much more efficient
>> than using multiple cookies? (example below)
>>
>> Response.Cookies("someCookie") = "101,102,103,104,105,106"
>> If InStr(Request.Cookies("someCookie"),"103") > 0 Then.......
>>
>> vs.
>>
>> Response.Cookies("101") = "True"
>> Response.Cookies("102") = "True"
>> Response.Cookies("103") = "True"
>> Response.Cookies("104") = "True"
>> Response.Cookies("105") = "True"
>> Response.Cookies("106") = "True"
>> If Request.Cookies("103") = "True" Then.....
>>
>>
>> Thank you!
>>
>
> The former is more effecient than the latter. Whether it is 'much' more
> effecient depends on the real world usage but creating multiple cookies
> will
> increase the size the requests being made to the server.

Hi!

In fact, each separate cookie is just one line in the HTML document as a
pre-content HTML-header. This is defined in RFC's and does not cost a lot
more resources or CPU.
It does not do a separate Server request (HTTP)
HOwever, since ASP is a script language, theoretically a Request.Cookies
statement is slower than a single Request.Cookies statement which can be
splitted into an array.
I would just choose the most convenient way of programming!

The most performance scalability is gotten by desiging good SQL scripts and
commands.
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm