MetaCard BenchmarksMetaCard's "virtual compiler" technology offers outstanding performance compared with the language interpreters used in HyperCard or SuperCard. No longer does choosing a high-level tool mean producing slow-running programs!In the first benchmark, a single stack that tests the most common operations was developed in HyperCard and then ported to SuperCard and MetaCard. The HyperCard and SuperCard stacks used in this test are available as mcbench.sit (the MetaCard benchmarks were run directly from the HyperCard stack). The results were that, on average, MetaCard is over 5 times faster than HyperCard and 6 times faster than SuperCard: Test MC SC HC SC/MC HC/MC --------------------------------------------------------------- empty repeat for 0.33 0.49 1.54 1.48 4.67 repeat with i 2.00 0.52 5.16 0.26 2.58 iterative factorial 0.30 3.13 1.40 10.43 4.67 iterative fact w/if 0.50 4.18 1.18 8.36 2.36 recursive factorial 0.19 5.25 3.32 27.63 17.47 read/write 1.27 6.13 4.52 4.83 3.56 nested chunks 1.59 4.25 13.50 2.67 8.49 chunks w/precount size 2.30 5.15 8.41 2.24 3.66 32K text set/get 15.31 5.28 5.45 0.34 0.36 1K text set/get 4.23 5.28 4.54 1.25 1.07 100 char text set/get 4.44 9.34 5.80 2.10 1.31 set prop 0.38 3.35 3.18 8.82 8.37 function call 0.50 1.26 0.32 2.52 0.64 replace string (offset) 1.43 5.49 4.24 3.84 2.97 small script compiled 0.20 0.42 0.40 2.10 2.00 small script "do" 0.42 8.14 10.58 19.38 25.19 big script compiled 5.46 22.20 9.15 4.07 1.68 big script "do" 12.56 80.41 38.58 6.40 3.07 -------------------------------------------------------------- Average MetaCard performance advantage: 6.04 5.23 -------------------------------------------------------------- create buttons (*) 0.16 0.37 58.00 2.31 362.50 --------------------------------------------------------------All times in seconds as reported by subtracting starting and ending times. The "create buttons (*)" task was not included in the benchmark averages because HyperCard completely falls apart in this test. All the script does is create 256 buttons, but with a time of over 1 second per button, clearly HyperCard is not the right tool to use if dynamic generation of controls will be a major component of an application. Note that these benchmarks are really showing worst-case performance for MetaCard because they doesn't take advantage of any MetaCard-specific features. For example, in the "32K text" benchmark, which tests the speed of moving 32K of text in and out of a field, the HyperCard and SuperCard times are comparable because they both use the MacOS TextEdit routines to manage the text which can only accept a maximum of 32K. There is no fixed limit to the amount of text you can put in a MetaCard field, and this increase in power and flexibility comes only with a minor hit in performance. Another example is the "nested chunks" test, which uses a loop variable to loop over the lines, items, words, and chars in a text string. In MetaCard, this would normally be done with the "repeat for each" keyword, use of which results in a time of 0.28 seconds for this test, which is 5.6 times faster than the algorithm that HC and SC must use. The net result is that MetaCard using "repeat for each" is almost 50 times faster than HyperCard using "repeat with i". Likewise, the MetaCard "replace" command makes short work of the "replace string" benchmark, completing it in 0.001 seconds, or over 1000 times faster than the way HC and SC must do it. Net result: MetaCard using its "replace" command is 4000 times faster than SuperCard using the "offset" function. The MetaCard performance advantage would be even greater with larger data sets.
SuperBench: MetaCard vs. SuperCard This benchmark provides some idea of the kind of performance advantages MetaCard has over SuperCard. This benchmark is based on SuperBench from Fourth World, which was designed to assess relative performance of pairs of SuperCard scripts. It exercises many of the most important features of the language, and so also makes a pretty good cross-tool benchmark.
Benchmark ST1 ST MT1 MT2 ratio -------------------------------------------------------- 1 ()/the 208 189 12 13 16 2 intersect/within 514 588 30 78 10 3 offset/number 744 878 * * 4 variable 730 758 39 75 13 5 worddel/offset 599 667 * * 6 set itemDel 347 144 6 4 49 7 handler call 652 152 22 1 35 8 length/empty 422 320 7 15 34 9 user function 237 158 6 2 49 10 math funcs 762 788 16 15 50 11 send/via 951 467 * * 12 get with if/via 782 349 * * 13 offset/is in 657 478 11 7 63 14# +/add 414 323 7 7 53 15 pass 255 153 25 2 15 16 len/ n of chars 172 171 4 6 34 17 len=0/empty 101 176 5 5 28 18 item/line del 379 601 * * 19 numtochar/lit 141 161 5 3 38 20 send/via 569 876 * * 21 numtochar/const 120 74 4 4 24 22 bad script (even for SC 3.0) 23 lit/const 65 43 2 3 22 24 the 614 609 80 80 8 25 math chunks 473 404 72 72 6 26% if-then/and 1354 1055 97 53 16 27 worddel 396 206 * * 28 chunks/offset 404 682 * * 29 isnumber 207 147 14 12 14 30 send (100) 865 92 * * 31 send w/set(100) 815 830 * * 32 add constant 492 253 5 6 68 33 delete 944 707 29 23 32 34 calibration 152 158 2 2 78 35 constant/number 112 95 5 4 23 36 set cursor 294 225 49 34 6 37 comments 350 340 13 13 27 38 do 112 469 13 131 4 39 do/send 469 508 126 116 4 40 in/offset 107 132 3 3 40 41 trunc()/div 195 152 6 6 29* MetaCard couldn't complete these benchmarks because it lacks the following SuperCard compatibility features:
# Benchmark 14 variable changed from "a" to "a1" ("a" is reserved in MT) % Line continuation character in 26 changed to \ from option-return The average performance advantage of MetaTalk over SuperTalk over all tests is 29.6 times. Notable measurements are the relatively low factor (4x) for the "do" and "send" benchmarks, which is caused by the overhead of the MetaCard "virtual compiler". The largest differences (50x or more) are in the math operations, which are specially optimized in MetaTalk. In several cases, the author of SuperBench apparently used setting the lineDel and wordDel as a "make work" procedure which served no useful purpose in the overall benchmark. This practice causes relative compatibility of the two languages to appear lower than it really is. The converted project is available here as superbench.mc . This converted project includes the two script changes noted above, and error messages inserted for the scripts that won't run in MetaCard. This stack can be run on any version of MetaCard, just click on the "SuperBenchx" item in the list in the "project" stack to open the benchmark screen. |
Back to the Conversion page. |