bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Boolean Packing


From: Elias Mårtenson
Subject: Re: [Bug-apl] Boolean Packing
Date: Fri, 21 Aug 2015 08:56:11 +0800

GNU APL boxes all objects and runs the constructor for each element when creating an array. A more complex type system would probably be able to treat a uniform array as a single "flat" object. This would reduce the array initialisation to a single loop, or perhaps even a call to memset().

Such optimisation is not impossible in GNU APL but I don't know how much work that would be.

Regards,
Elias

On 21 Aug 2015 05:18, "Mike Duvos" <address@hidden> wrote:
Hi Blake,

The other array languages I use, SAX, APL2, and J, all pack booleans.  You get the advantage of being able to do scalar primitives 32 bits at a time, efficient use of memory, with only a small overhead in terms of fetching individual elements for mixed structural primitives.

Providing WA is accurate, one wonders how one could possibly store booleans in a way that requires over 40 bytes per bit.

This is almost a show-stopper in terms of using this APL for production. 

To contrast, making a 274 by 65536 bitmap of boolean 1's takes 32 milliseconds under APL2 and uses 2.2 meg of memory.

In GNU APL, it takes 4 seconds and uses 862 meg.

So if GNU APL is realizing some economy here, I fail to see it.

Regards,

Mike


On Thu, Aug 20, 2015 at 1:33 PM, Blake McBride <address@hidden> wrote:
Big trade-off.  Packing and unpacking with a lot of operations has got to be CPU expensive.  Not packing is memory expensive.  If I am correct, then I have a slight leaning towards the way GNU APL did it.  If I am wrong and the expense of packing / unpacking over many operations is not expensive, then I'd lean towards IBM.

Blake


On Thu, Aug 20, 2015 at 3:16 PM, Mike Duvos <address@hidden> wrote:
[IBM APL2]

      WA←⎕WA ⋄ A←1000 1000⍴1=1 ⋄ WA-⎕WA
125056

      

[GNU APL]

      WA←⎕WA ⋄ A←1000 1000⍴1=1 ⋄ WA-⎕WA
48046080

APL2 obviously packs boolean ravels 8 bits per byte.  How does GNU APL store its booleans?

I use large bitmaps a lot in my code, so having them stored packed in the workspace is a huge issue for me.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]