Removing [showif] makes a big difference in speed
This WebDNA talk-list message is from 1997
It keeps the original formatting.
numero = 10779
interpreted = N
texte = Hi Grant,The following HTML is supposed to lookup a record in the sum.db for arecord with today's date. If it cannot find one, it creates a new one, andthen it goes thru a time-consuming procedure (inside the [showif] context)which calculates a new value for the 'sum' field based on the searchresults and math calculations in another database, then it places thatvalue into a newly-appended record in the sum.db.The whole idea is to make subsequent hits to this page run as if the[showif] stuff is not even there ... but that's not what happens. I wasunder the impression that this WebDNA would be slow only when the veryfirst person of the day request the page ... because that's the only timethe [search] and [math] and [append] would have to be performed ... becausethat's when the [showf] test would be 'true'. Every other hit of the daywould return a [showif] test of 'false' which should skip all the enclosedWebDNA and go directly to the following [lookup] which is very fast.Unfortunately, it seems like WebCat2 performs the [search] and the [math]even when the enclosing [showif] test is evaluated as false.I'm not saying that WebCat2 is showing the results of this hidden activity,because it is *not*. WebCat2 is still delivering the results I wouldexpect, but it takes just as long on subsequent hits as on the very firsthit of the day - and that's what I thought I was avoiding with this code.In order to make sure the stuff inside the [showif] context was causing theslowdown, I removed the [showif] context and everything inside it just tosee what difference it would make. The difference is like night and day! Ittakes at least 16-17 seconds with the [showif] stuff in the template, andonly 0.083 seconds without it.Why does WebCat2 *not* skip directly to the end of the [showif] contextwhen the test is false?[showif[lookupdb=sum.db&value=[date]&lookInField=sumDate&returnField=sumDate¬Found=]![date]][append db=sum.db]sumDate=[date]&sum=[search db=agents.db&nepricedata=0][math]([founditems][price]+[/founditems]0)/1000000[/math][/search][/append][/showif][format thousands .1f][lookup db=sum.db&value=[date]&lookInField=sumDate&returnField=sum¬Found=][/format]Sincerely,Ken
Associated Messages, from the most recent to the oldest:
Hi Grant,The following HTML is supposed to lookup a record in the sum.db for arecord with today's date. If it cannot find one, it creates a new one, andthen it goes thru a time-consuming procedure (inside the
[showif] context)which calculates a new value for the 'sum' field based on the searchresults and math calculations in another database, then it places thatvalue into a newly-appended record in the sum.db.The whole idea is to make subsequent hits to this page run as if the
[showif] stuff is not even there ... but that's not what happens. I wasunder the impression that this WebDNA would be slow only when the veryfirst person of the day request the page ... because that's the only timethe
[search] and
[math] and
[append] would have to be performed ... becausethat's when the [showf] test would be 'true'. Every other hit of the daywould return a
[showif] test of 'false' which should skip all the enclosedWebDNA and go directly to the following
[lookup] which is very fast.Unfortunately, it seems like WebCat2 performs the
[search] and the
[math]even when the enclosing
[showif] test is evaluated as false.I'm not saying that WebCat2 is showing the results of this hidden activity,because it is *not*. WebCat2 is still delivering the results I wouldexpect, but it takes just as long on subsequent hits as on the very firsthit of the day - and that's what I thought I was avoiding with this code.In order to make sure the stuff inside the
[showif] context was causing theslowdown, I removed the
[showif] context and everything inside it just tosee what difference it would make. The difference is like night and day! Ittakes at least 16-17 seconds with the
[showif] stuff in the template, andonly 0.083 seconds without it.Why does WebCat2 *not* skip directly to the end of the
[showif] contextwhen the test is false?[showif[lookupdb=sum.db&value=
[date]&lookInField=sumDate&returnField=sumDate¬Found=]!
[date]][append db=sum.db]sumDate=
[date]&sum=[search db=agents.db&nepricedata=0]
[math](
[founditems][price]+[/founditems]0)/1000000[/math][/search][/append][/showif][format thousands .1f][lookup db=sum.db&value=
[date]&lookInField=sumDate&returnField=sum¬Found=][/format]Sincerely,Ken
Kenneth Grome
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Running on Empty (1999)
Modifying order output (1997)
WebCat2b13MacPlugIn - More limits on [include] (1997)
japanese characters (1997)
Searchable WebCat (etc.) Docs ? (1997)
Getting Total Quantity (1997)
Webcat causing crashes left and right! (1997)
suggestions for a good text editor on windows? (2005)
Nested tags count question (1997)
Webcatalog 4.0 - When will we be able to beta test it? (2000)
[Listfiles] vs Netfinder (1997)
Possible to reset Linux file permissions w/in webcat [shell] ? (2000)
WebCommerce: Folder organization ? (1997)
Problem with Formulas.db (1998)
question: webdelivery folder and file (1997)
Setting Lineitems (2005)
forming a SKU (1999)
WebCat2b15MacPlugIn - [authenticate] not [protect] (1997)
[WebDNA] Help with work-around format date (2013)
[WebDNA] apache 2.4 (2014)