New Message: Optimizing script code
webmaster at userland.com
webmaster at userland.com
Mon Apr 21 08:00:55 PDT 2003
A new message was posted:
Address: http://frontier.userland.com/discuss/msgReader$11715
By: Michael Myers (michael.myers at roche.com)
I have been using the profile feature to identify problem scripts in my web application. Answers to the following probably require knowledge of the kernel.
Would there be much of speed difference between the following syntax:
if s
{ do something}
if s != ""
{do something}
The effect might be subtle, but I often omit the explicit conditional test and this might add up.
In one script I have a case statement with 130 elements. Would it be faster to implement this as a table-based lookup? The coding would become a bit more complex, so I have avoid doing it.
I have a strong suspicion that usertalk's string.countFields() and string.nthField() verbs could be optimized. I had noticed this a couple years ago when parsing lines from text files. Now I see these verbs as a noticeable trend in my slowest scripts from the profile listing. These scripts are not parsing large strings, though.
UserTalk needs native string.split() and string.join() verbs that don't rely on the regex dll!
mpm
This is a Manila site.. http://manila.userland.com/.
More information about the Frontier-Server
mailing list