-- card: 7605 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2685 -- name: Benchmark -- part 1 (button) -- low flags: 00 -- high flags: A003 -- rect: left=326 top=32 right=54 bottom=426 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Benchmark ----- HyperTalk script ----- on mouseUp set cursor to watch put return & "__________ Start benchmark" & return after card field "Output" -- Get time to execute simple repeat loop -- The resulting time is subtracted from all other results. put ticks() into start repeat with i=1 to 100 put empty into nothing end repeat put ticks()-start into delta -- A null command causes ArrayList to do the minimum amount -- of processing. All that happens is that the XFCN -- is loaded by HyperCard, initializes itself, and then returns -- almost immediately. put "Time a null command: " after card field "Output" put ticks() into start repeat with i=1 to 100 get alist() end repeat put (ticks()-start-delta)/100 & return after card field "Output" -- A junk command causes ArrayList to execute its command decoding -- functions. But, since it's a junk command, no action is taken. put "Time a junk command: " after card field "Output" put ticks() into start repeat with i=1 to 100 get alist(junk) end repeat put (ticks()-start-delta)/100 & return after card field "Output" -- The search command with the list parameter causes ArrayList -- to lookup the find command, and then to also look up the -- named list. This test gives the time used to look up the -- list. put "Time list lookup: " after card field "Output" put ticks() into start repeat with i=1 to 100 get alist(search, list) end repeat put (ticks()-start-delta)/100 & return after card field "Output" -- Executes the search command with an empty list. put "Time empty search on empty list: " after card field "Output" put ticks() into start repeat with i=1 to 100 get alist(search, list, "") end repeat put (ticks()-start-delta)/100 & return after card field "Output" -- This test is used for comparison with other timing tests -- above. put "Time size command: " after card field "Output" put ticks() into start repeat with i=1 to 100 get alist(size, list) end repeat put (ticks()-start-delta)/100 & return after card field "Output" put "__________ End benchmark" & return after card field "Output" end mouseUp -- part 2 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=255 top=65 right=301 bottom=508 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Output -- part contents for background part 9 ----- text ----- DemoStack 0.9 -- part contents for background part 1 ----- text ----- Benchmark -- part contents for background part 12 ----- text ----- Card #9 -- part contents for card part 2 ----- text ----- Data for ArrayList on a standard MacPlus: __________ Start benchmark Time a null command: 2 Time a junk command: 2.55 Time list lookup: 3.35 Time empty search on empty list: 3.44 Time size command: 3.33 __________ End benchmark -- part contents for background part 14 ----- text ----- This card contains some benchmarks which illustrate how long certain commands take to execute. The comments in the script of the "Benchmark" button explain what each time is. (All times are given as 1/60's of a second.) -- part contents for background part 13 ----- text ----- Description