[ic] Strange behavior when using CGI values as loop list elements

Marty Tennison marty at sediva.com
Wed Feb 25 23:39:36 UTC 2009


Mike Heins wrote:
>>
>> It's an illusion. These times are so small that you can't count on them.
>> Try this:
>>
>>     

Thank you for the pointer.  Yes, you were right, my example was much too
terse.  In my quest for clarity I missed the target. :)

Here is a more complete example that. When I run these two loops, the
CGI examples takes 84 seconds to run while the scratch example takes
0.640 seconds.  Pretty dramatic. 

The weird thing is, if I put both of the loops into the same page and
call it, they both have similar times. If break them up into seperate
pages and call one with the CGI varibles and one without, the CGI page
slows to a crawl.

I put these examples into separate pages and call them both like this....

http://www.domain.com/test?looplist=1+2+3+4+5+6+7+8+9


======= EXAMPLE 1 ===========

<p>Looping with CGI variables...

[tmp looplist][cgi sku1] [cgi sku2] [cgi sku3] [cgi sku4] [cgi sku5][/tmp]

[benchmark start=1]

[query
    type=list
    sql="select sku from products limit 100"]
   
    [loop list="[cgi looplist]"]
   
        [tmp junk1]1[/tmp]
        [tmp junk2]2[/tmp]
        [tmp junk3]3[/tmp]
        [tmp junk4]4[/tmp]
        [tmp junk5]5[/tmp]
        [tmp junk6]6[/tmp]
        [tmp junk7]7[/tmp]
        [tmp junk8]8[/tmp]
        [tmp junk9]9[/tmp]
        [tmp loop1][loop-code][/tmp]
        [tmp loop2][loop-code][/tmp]
        [tmp loop3][loop-code][/tmp]
        [tmp loop4][loop-code][/tmp]
        [tmp loop5][loop-code][/tmp]
        [tmp loop6][loop-code][/tmp]
        [tmp loop7][loop-code][/tmp]
        [tmp loop8][loop-code][/tmp]
        [tmp loop9][loop-code][/tmp]

    [/loop]

[/query]

CGI TIME:[benchmark]


======= EXAMPLE 2 ===========


<p>Looping with scratch (must be called separately from cgi example)...
[tmp looplist]1 2 3 4 5 6 7 8 9[/tmp]

[benchmark start=1]

[query
    type=list
    sql="select sku from products limit 100"]
   
    [loop list="[scratch looplist]"]
   
        [tmp junk1]1[/tmp]
        [tmp junk2]2[/tmp]
        [tmp junk3]3[/tmp]
        [tmp junk4]4[/tmp]
        [tmp junk5]5[/tmp]
        [tmp junk6]6[/tmp]
        [tmp junk7]7[/tmp]
        [tmp junk8]8[/tmp]
        [tmp junk9]9[/tmp]
        [tmp loop1][loop-code][/tmp]
        [tmp loop2][loop-code][/tmp]
        [tmp loop3][loop-code][/tmp]
        [tmp loop4][loop-code][/tmp]
        [tmp loop5][loop-code][/tmp]
        [tmp loop6][loop-code][/tmp]
        [tmp loop7][loop-code][/tmp]
        [tmp loop8][loop-code][/tmp]
        [tmp loop9][loop-code][/tmp]

    [/loop]

[/query]

SCRATCH TIME:[benchmark]



-- 
-  - -- ----  ---------------------------- --- -- -   -
Marty Tennison                     The Sediva Company
email: marty at sediva.com
web: www.sediva.com
phone: +1-888-208-4755 x102
fax: +1-866-686-6719
-  -- --- --------------------------------------- --- --




More information about the interchange-users mailing list