On Wed, 16 Oct 2002, Viktor wrote:
Such a small benchmark:
[ | a | a := Array new: 1. 10000000 timesRepeat: [ a at: 1 put: 3.] ] millisecondsToRun
Strongtalk (best time from 10 runs): ... 45 ms ... 100 % VisualWorksR NonCommercial, Release 5i.3 of January 30, 2001 ... 220 ms ... 488 % Dolphin Smalltalk Pro 4.0.1. ... 820 ms ... 1822 % Squeak3.2-4956 ... 2410 ms ... 5355% Kathmandu Objects (my poor Smalltalk) ... 7881 ms ... 17513 % Visual C++ (see code bellow) ... 14 ms ... 31 %
DWORD BegTime = ::GetTickCount(); DWORD *Array = new DWORD [1]; for (DWORD Index = 0; Index < 10000000; Index++) { Array [0] = 3; }; DWORD TotalTime = ::GetTickCount() - BegTime; delete Array;
To be a little bit more fair you should write the Squeak benchmark exactly like the C++ one:
| a | a := Array new: 1. 1 to: 10000000 do: [:i| a at: 1 put: 3.]
Using #to:do: gives a speed-up by 100% here!
-- Bert
PS: of course, we should change the implementation of #timesRepeat: accordingly