Newbie: Benchmarking Squeak vs. Flash, Director and IE
Ralf Bokelberg
squeak at bokelberg.de
Wed Jan 15 21:08:00 UTC 2003
Hi Group,
i just found Squeak and i'm very interested to
work with it, because of its oop language and
its multimedia features.
I just tried to evaluate its performance and i'm wondering
if i did it correct, since it seems to be pretty fast. At least
from my point of view, since i'm mostly working with flash.
squeak/smalltalk result ms: 7 (62 with 100000 loops)
director/lingo result ms: 33 (300 ms with 100000 loops)
javascript/ie5.5 result ms: 100 (610 ms with 100000 loops)
actionscript/flash mx result ms: 1382
Maybe you can take a short look at my smalltalk script
and tell me, if it is correct ? It should create an object and
call its method func 10000 times.
<code lang="squeak">
"smalltalk squeak 3.2"
"Part 1"
"The definition of the class"
Object subclass: #MyClass
instanceVariableNames: 'x'
classVariableNames: ''
poolDictionaries: ''
category: 'My Stuff'
initialize
x _ 0.
func: parm
x _ x + parm
"Part 2"
"Script running in a workspace"
Time millisecondsToRun: [
myobj _ MyClass new.
myobj initialize.
1 to: 10000 do: [:i | myobj func: 1].
].
"result ms: 7 (62 with 100000 loops)"
</code>
---------------------
If you like to compare by yourself,
here are the scripts i used in the other
systems:
<code lang="lingo">
-- Lingo Director 8
-- Part 1
-- script "parentObj"
-- The parent script
property x
on new me
x = 0
end
on func me, parm
x = x + parm
end func
-- Part 2
-- script "main"
on exitFrame me
t = the ticks
i = 0
obj = new (script "parentObj")
repeat while i < 10000
obj.func(1)
i = i + 1
end repeat
put obj.x & " " & (1000 * (the ticks - t) / 60)
end
-- result ms: 33 (300 ms with 100000 loops)
</code>
---------------------
<code lang="javascript">
<html>
<head>
<script>
<!--
// Javascript IE 5.5
function MyClass(){
this.x = 0;
}
MyClass.prototype.func = function(parm){
this.x += parm;
}
var t = new Date().getTime();
var obj = new MyClass();
for(var i=0; i<10000; i++){
obj.func(1);
}
alert(obj.x + ":" + (new Date().getTime()-t));
//result ms: 100 (610 ms with 100000 loops)
//-->
</script>
</head>
</html>
</code>
---------------------
<code lang="actionscript">
// Actionscript Flash MX
function MyClass(){
this.x = 0;
}
MyClass.prototype.func = function(parm){
this.x += parm;
}
var t = new Date().getTime();
var obj = new MyClass();
for(var i=0; i<10000; i++){
obj.func(1);
}
trace(obj.x + ":" + (new Date().getTime()-t));
//result ms: 1382
</code>
Kind regards
bokel
More information about the Squeak-dev
mailing list
|