SC, Rev,and RB speed test
Brian Yennie
briany at qldlearning.com
Thu Apr 15 01:47:41 EDT 2004
Chris,
> I'm conducting an informal speed test comparing identical projects in
> SuperCard (4.1.2), Revolution (2.2), and RealBasic (5.5.1). The
> projects match 3,000 short phrases against an 81,920 word text. There
> has already been some feedback and these simple projects are now
> running even faster. Each one is only a dozen lines of code.
>
> Here are the current statistics:
>
> RealBasic -- 234 ticks
> Revolution -- 1120 ticks
> SuperCard -- 1889 ticks
The following gave me about a 25% speedup by using offset() instead of
"contains".
THEN... I thought of keeping track of already searched for strings in
an array, which got the whole thing down to 2 ticks. Of course the
effect of the latter will be much less with more random data, but it
helps (and should in all of the languages).
I also found that you definitely have a faster computer than me... my
original run took 3377 ticks!
My other benchmarks were 2586 ticks by using offset(), and 2 ticks by
using arrays to notice redundant queries.
Hope that helps... it's still pretty readable which should be worth
something =)
#########
on mouseUp
local
tFind,tSearch,tLine,tMatchList,tTicks,tAlreadyFound,tAlreadyMissed
put "" into cd fld "TheResults"
put the ticks into sticks
put cd fld "TargetText" into theText
put field "SearchTextList" into stList
repeat for each line stLine in stList
if (tAlreadyFound[stLine] = "!") then
put stLine & cr after tMatchList
else if (tAlreadyMissed[stLine] = "!") then
next repeat
else if (offset(stLine, theText) > 0) then
put stLine & cr after tMatchList
put "!" into tAlreadyFound[stLine]
else
put "!" into tAlreadyMissed[stLine]
end if
end repeat
put tMatchList into cd fld "TheResults"
put the ticks - sticks && "ticks" into cd fld "SpeedRecords"
end mouseUp
More information about the use-livecode
mailing list