----boundary-LibPST-iamunique-400963224_-_-
Content-type: text/plain
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
----boundary-LibPST-iamunique-400963224_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0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NoZWxsOlxwYXINClxwYXINClZBUiBhLCBiOiBBUlJBWSAxMDAwMDAw
IE9GIFJFQUw7ICBpLCBqOiBJTlRFR0VSOyAgc3VtOiBSRUFMO1xwYXINClxwYXINCkJFR0lOXHBh
cg0Kc3VtOj0gMDtccGFyDQpGT1Igajo9IDAgVE8gMTk5IERPXHBhcg0KICAgICAgICBGT1IgaTo9
IDAgVE8gOTk5OTk5IERPXHBhcg0KICAgICAgICAgICAgICAgIGFbaV06PSBpLWo7XHBhcg0KICAg
ICAgICAgICAgICAgIGJbaV06PSBpLWo7XHBhcg0KICAgICAgICAgICAgICAgIEVORDtccGFyDQog
ICAgICAgIEZPUiBpOj0gMCBUTyA5OTk5OTkgRE9ccGFyDQogICAgICAgICAgICAgICAgc3VtOj0g
c3VtICthW2ldKmJbaV07XHBhcg0KICAgICAgICAgICAgICAgIEVORDtccGFyDQogICAgICAgIEVO
RDtccGFyDQpTdGRMb2cuUmVhbCggc3VtKTsgU3RkTG9nLkxuXHBhcg0KXHBhcg0KXHBhcg0KICAg
ICAgICBDb25jbHVzaW9uczogIDEuIFVzZSBXaXJ0aCBsYW5ndWFnZXMgZm9yIG51bWVyaWNhbCBw
cm9ncmFtbWluZy4gIDstKSAgMi4gV2hvIG5lZWRzIGEgc28tY2FsbGVkIG9wdGltaXppbmcgY29t
cGlsZXI/XHBhcg0KXHBhcg0KU2luY2VyZWx5LFxwYXINClJleCBDb3V0dXJlIFxwYXINClxwYXIN
Ci0tLSBCbGFja0JveFxwYXINCi0tLSBzZW5kIHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0
byBibGFja2JveEBvYmVyb24uY2hccGFyDQpccGFyDQp9
----boundary-LibPST-iamunique-400963224_-_---
Received on Fri Nov 03 2006 - 01:40:54 UTC