----boundary-LibPST-iamunique-1586639766_-_-
Content-type: text/plain
Hey Rex
Don't you get Stack Overflow?
Or are you using global arrays?
I'm just trying this thing and when using local arrays with a total use of
16MB stack, BB behaves very badly!!!
mc
-----Original Message-----
From: blackbox{([at]})nowhere.xy
Couture
Sent: Friday, November 03, 2006 01:41
To: BlackBox Mailing List
Subject: [BlackBox] - Speed test
Just for fun, I thought you might like to see the results of an
informal speed test I did. The program tests a common sort of loop
operation that eats up a lot of time in some of my programs. I tested
BlackBox against Delphi 6 and a leading FORTRAN 95 compiler, which I chose
for adequate speed plus standards compliance. None of the compilers is
exactly the latest technology, but they should not be bad either. The tests
were done on a 600 MHz Pentium, Windows XP.
RESULTS
* F95 (optimized, no range checking) 24 s
* F95 (not opt., no range checking) 31 s
* Delphi (optimized or not) 31 s
* BB 31 s
* BB (loop unrolled) 6 s
* F95 (optimized, range checking) 11 min 40 s
That's right. By optimizing (unrolling the loop) the FORTRAN
compiler can beat Delphi and BB by about 20%. Without optimizing it
performs almost exactly like Delphi and BB, but that's without range
checking (array subscript range testing). BB and Delphi perform range
checking with little overhead, but with the FORTRAN compiler, you're lucky
to get same day service.
Just for the fun of it, I manually unrolled the loop by 5 times in
the BB program, and there was a huge improvement. If you have to get it
done fast, that's the way to go.
Here's the BB program in a nutshell:
VAR a, b: ARRAY 1000000 OF REAL; i, j: INTEGER; sum: REAL;
BEGIN
sum:= 0;
FOR j:= 0 TO 199 DO
FOR i:= 0 TO 999999 DO
a[i]:= i-j;
b[i]:= i-j;
END;
FOR i:= 0 TO 999999 DO
sum:= sum +a[i]*b[i];
END;
END;
StdLog.Real( sum); StdLog.Ln
Conclusions: 1. Use Wirth languages for numerical programming. ;-)
2. Who needs a so-called optimizing compiler?
Sincerely,
Rex Couture
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-1586639766_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhleSBSZXhccGFyDQpccGFyDQpEb24ndCB5b3Ug
Z2V0IFN0YWNrIE92ZXJmbG93P1xwYXINCk9yIGFyZSB5b3UgdXNpbmcgZ2xvYmFsIGFycmF5cz9c
cGFyDQpccGFyDQpJJ20ganVzdCB0cnlpbmcgdGhpcyB0aGluZyBhbmQgd2hlbiB1c2luZyBsb2Nh
bCBhcnJheXMgd2l0aCBhIHRvdGFsIHVzZSBvZlxwYXINCjE2TUIgc3RhY2ssIEJCIGJlaGF2ZXMg
dmVyeSBiYWRseSEhIVxwYXINClxwYXINCm1jXHBhcg0KXHBhcg0KLS0tLS1PcmlnaW5hbCBNZXNz
YWdlLS0tLS1ccGFyDQpGcm9tOiBibGFja2JveEBvYmVyb24uY2ggW21haWx0bzpibGFja2JveEBv
YmVyb24uY2hdT24gQmVoYWxmIE9mIFJleFxwYXINCkNvdXR1cmVccGFyDQpTZW50OiBGcmlkYXks
IE5vdmVtYmVyIDAzLCAyMDA2IDAxOjQxXHBhcg0KVG86IEJsYWNrQm94IE1haWxpbmcgTGlzdFxw
YXINClN1YmplY3Q6IFtCbGFja0JveF0gLSBTcGVlZCB0ZXN0XHBhcg0KXHBhcg0KXHBhcg0KICAg
ICAgICBKdXN0IGZvci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QpccGFyDQpCRUdJTlxwYXINCnN1bTo9IDA7XHBhcg0KRk9SIGo6
PSAwIFRPIDE5OSBET1xwYXINCiAgICAgICAgRk9SIGk6PSAwIFRPIDk5OTk5OSBET1xwYXINCiAg
ICAgICAgICAgICAgICBhW2ldOj0gaS1qO1xwYXINCiAgICAgICAgICAgICAgICBiW2ldOj0gaS1q
O1xwYXINCiAgICAgICAgICAgICAgICBFTkQ7XHBhcg0KICAgICAgICBGT1IgaTo9IDAgVE8gOTk5
OTk5IERPXHBhcg0KICAgICAgICAgICAgICAgIHN1bTo9IHN1bSArYVtpXSpiW2ldO1xwYXINCiAg
ICAgICAgICAgICAgICBFTkQ7XHBhcg0KICAgICAgICBFTkQ7XHBhcg0KU3RkTG9nLlJlYWwoIHN1
bSk7IFN0ZExvZy5MblxwYXINClxwYXINClxwYXINCiAgICAgICAgQ29uY2x1c2lvbnM6ICAxLiBV
c2UgV2lydGggbGFuZ3VhZ2VzIGZvciBudW1lcmljYWwgcHJvZ3JhbW1pbmcuICA7LSlccGFyDQoy
LiBXaG8gbmVlZHMgYSBzby1jYWxsZWQgb3B0aW1pemluZyBjb21waWxlcj9ccGFyDQpccGFyDQpT
aW5jZXJlbHksXHBhcg0KUmV4IENvdXR1cmVccGFyDQpccGFyDQotLS0gQmxhY2tCb3hccGFyDQot
LS0gc2VuZCBzdWJqZWN0IEhFTFAgb3IgVU5TVUJTQ1JJQkUgdG8gYmxhY2tib3hAb2Jlcm9uLmNo
XHBhcg0KXHBhcg0KLS0tIEJsYWNrQm94XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBIRUxQIG9yIFVO
U1VCU0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbn19AEl1SUNCWGFYUm9JSFI=
----boundary-LibPST-iamunique-1586639766_-_---
Received on Fri Nov 03 2006 - 08:03:00 UTC