Re: [BLACKBOX] INTEGER arithmetic speed

From: [at]} <Norayr>
Date: Thu, 20 Oct 2011 01:37:40 +0500

----boundary-LibPST-iamunique-1770433885_-_-
Content-type: text/plain

Hmmm.
That's an interesting point.

I am not an expert in Intel CPU internals, however, let me share some
thoughts:

No, I don't think that FPU is used with LONGINT, though it can be found
out by disassembling the binaries. Or is there a way to get an asm
output? I guess no, and Blackbox directly generates binaries without
extra step with an assembler.
FPU is used with REAL and LONGREAL, and that's not convenient (to my
knowledge) to use FPU for LONGINT, and then cast it.

May be 32bit Intel CPUs work faster with eax, ebx registers, which I
suppose should be used for LONGINT, than with ax, bx, which are probably
used when dealing with INTEGERs.
And I guess that behaviour may change from one cpu version to other.

Norayr

On 10/19/11 19:54, Campbell, Robert (SELEX GALILEO, UK) wrote:
> I have developed an algorithm that uses LONGINTs, and for a particular
> input takes
> 3.5 minutes to run.
>
> I don't always need such large numbers, so I cut-and-pasted an INTEGER
> version, which gives the same
> results for this input, but takes 5 minutes.
>
>
> Is this a freak result (maybe to do with cache boundaries or something),
> or is it a general
> situation that INTEGER arithmetic is 50% slower than LONGINT arithmetic
> - the algorithm has a
> varied mix of MODs, DIVs, adds, PROCEDURE calls, and assigments to&
> from ARRAYs?
>
>
> Regards
>
> Robert
> SELEX Galileo Ltd
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
> A company registered in England& Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
>
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
>


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1770433885_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGY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ugb3JccGFyDQo+IGRpc3RyaWJ1
dGUgaXRzIGNvbnRlbnRzIHRvIGFueSBvdGhlciBwZXJzb24uXHBhcg0KPiAqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxw
YXINCj5ccGFyDQo+XHBhcg0KPiAtLS0tXHBhcg0KPiBUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1l
c3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVS
T04uQ0hccGFyDQo+XHBhcg0KXHBhcg0KXHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2NyaWJlLCBz
ZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJ
U1RTLk9CRVJPTi5DSFxwYXINCn0=
----boundary-LibPST-iamunique-1770433885_-_---
Received on Wed Oct 19 2011 - 22:37:40 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:10 UTC