Best practices for cookies in classic ASP - memory usage

Discussion in 'ASP General' started by MartyN, May 30, 2007.

  1. MartyN

    MartyN Guest

    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!
     
    MartyN, May 30, 2007
    #1
    1. Advertising

  2. "MartyN" <> wrote in message
    news:...
    > 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.
     
    Anthony Jones, May 30, 2007
    #2
    1. Advertising

  3. "Anthony Jones" <> schreef in bericht
    news:...
    >
    > "MartyN" <> wrote in message
    > news:...
    >> 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
     
    Egbert Nierop \(MVP for IIS\), May 30, 2007
    #3
    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. news.microsoft.com
    Replies:
    0
    Views:
    570
    news.microsoft.com
    May 3, 2004
  2. karim
    Replies:
    0
    Views:
    485
    karim
    Jul 13, 2003
  3. _Who
    Replies:
    7
    Views:
    2,768
  4. Lorenzo Bolognini

    ASP Classic Best Practices

    Lorenzo Bolognini, Sep 19, 2003, in forum: ASP General
    Replies:
    16
    Views:
    348
    Bob Barrows
    Sep 22, 2003
  5. Rainer Weikusat

    Database usage best practices

    Rainer Weikusat, Sep 26, 2012, in forum: Perl Misc
    Replies:
    11
    Views:
    650
    Rainer Weikusat
    Sep 30, 2012
Loading...

Share This Page