Re: [BLACKBOX] ARRAY as CONSTANT

From: [at]} <CFB>
Date: Wed, 13 Feb 2008 16:26:10 +1030

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Oleg N. Cher
> Sent: Wednesday, 13 February 2008 2:58 PM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] ARRAY as CONSTANT
>
>
> What we will have? 60 Kb of machine code produces 10 Kb of data.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If your data are integers then the alternative is 40Kb of data not 10Kb of
data. Otherwise your original Delphi code example should have been written
as:

  CONST
    a: PACKED ARRAY [0..4] OF BYTE = (1, 2, 3, 4, 5);

instead of:

  CONST
    a: ARRAY [0..4] OF INTEGER = (1, 2, 3, 4, 5);

Now if that is the case, every time you try to access an element of data it
is going to require more, and inefficient code, as 8-bit byte accesses are
more inefficient than 32-bit integer accesses. (On Win32 that is)

Six of one - half a dozen of the other - what you might save in one area
costs you in another. It is not quite as simple as it may seem at first
sight ....

Chris Burrows
CFB Software
http://www.cfbsoftware.com/cp


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1967545577_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQ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wgMywgNCwgNSk7XHBhcg0KXHBh
cg0KTm93IGlmIHRoYXQgaXMgdGhlIGNhc2UsIGV2ZXJ5IHRpbWUgeW91IHRyeSB0byBhY2Nlc3Mg
YW4gZWxlbWVudCBvZiBkYXRhIGl0XHBhcg0KaXMgZ29pbmcgdG8gcmVxdWlyZSBtb3JlLCBhbmQg
aW5lZmZpY2llbnQgY29kZSwgYXMgOC1iaXQgYnl0ZSBhY2Nlc3NlcyBhcmVccGFyDQptb3JlIGlu
ZWZmaWNpZW50IHRoYW4gMzItYml0IGludGVnZXIgYWNjZXNzZXMuIChPbiBXaW4zMiB0aGF0IGlz
KVxwYXINClxwYXINClNpeCBvZiBvbmUgLSBoYWxmIGEgZG96ZW4gb2YgdGhlIG90aGVyIC0gd2hh
dCB5b3UgbWlnaHQgc2F2ZSBpbiBvbmUgYXJlYVxwYXINCmNvc3RzIHlvdSBpbiBhbm90aGVyLiBJ
dCBpcyBub3QgcXVpdGUgYXMgc2ltcGxlIGFzIGl0IG1heSBzZWVtIGF0IGZpcnN0XHBhcg0Kc2ln
aHQgLi4uLlxwYXINClxwYXINCkNocmlzIEJ1cnJvd3NccGFyDQpDRkIgU29mdHdhcmVccGFyDQpo
dHRwOi8vd3d3LmNmYnNvZnR3YXJlLmNvbS9jcFxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpU
byB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9Y
IiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0hcfX0AYiBp
----boundary-LibPST-iamunique-1967545577_-_---
Received on Wed Feb 13 2008 - 06:56:10 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:03 UTC