Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
Ah, and I just found Bitset in the trunk. But it seems not directly VM-supported and cannot be created from other arrays. And it is zero-indexed. :o ^^
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2023-12-15T00:44:39+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
Sent from Squeak Inbox Talk
Bitset is VM-supported in the sense that it uses bit-operation primitives 14, 15, 16, and 17 on SmallInteger. You are probably looking for a primitive that can do Bitset >> #clearBitAt: or #setBitAt:. Not sure whether this would yield a noticeable speed-up.
For initialization, you can probably just use any ByteArray and set it as #bytes in Bitset with a fitting value for #tally.
Best, Marcel
Am 15.12.2023 01:22:25 schrieb Thiede, Christoph christoph.thiede@student.hpi.uni-potsdam.de:
Ah, and I just found Bitset in the trunk. But it seems not directly VM-supported and cannot be created from other arrays. And it is zero-indexed. :o ^^
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2023-12-15T00:44:39+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
Sent from Squeak Inbox Talk
A good way to find out if it would yield a noticeable speed-up is to try it. Write a little "quick and dirty" VM plugin and implement a couple of primitives. Don't bother with any error checking, just make it work. If you can measure any noticeable performance difference, then consider cleaning up the primitives and putting them somewhere in the VM, possibly in some existing plugin. The worst that can possibly happen is that you will end up learning how to write a simple VM plugin, which is a handy thing to know how to do :-)
Dave
On 2023-12-21 10:31, Taeumel, Marcel via Squeak-dev wrote:
Bitset is VM-supported in the sense that it uses bit-operation primitives 14, 15, 16, and 17 on SmallInteger. You are probably looking for a primitive that can do Bitset >> #clearBitAt: or #setBitAt:. Not sure whether this would yield a noticeable speed-up.
For initialization, you can probably just use any ByteArray and set it as #bytes in Bitset with a fitting value for #tally.
Best, Marcel
Am 15.12.2023 01:22:25 schrieb Thiede, Christoph christoph.thiede@student.hpi.uni-potsdam.de:
Ah, and I just found Bitset in the trunk. But it seems not directly VM-supported and cannot be created from other arrays. And it is zero-indexed. :o ^^
Best, Christoph
Sent from Squeak Inbox Talk
On 2023-12-15T00:44:39+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
Sent from Squeak Inbox Talk
I cannot go into this right away, but what is the nature of tests that are failing?
The idea of that implementation is t use BitBlt as its bulk operation primitives; so it is optimized that way.
On Thu, Dec 14, 2023 at 3:57 PM christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
Sent from Squeak Inbox Talk
Thanks for all your comments! Yes, it makes sense to use bit manipulation primitives for an array of bits. For any performance questions, I would need to have a real use case first. I was mainly a bit disappointed that Bitset does not share the interface of other collections regarding one-indexed access and conversion ...
@Yoshiki: BitArrayTest>>#testHash fails after flipping a bit.
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2023-12-21T10:35:47-08:00, yoshiki.ohshima@acm.org wrote:
I cannot go into this right away, but what is the nature of tests that are failing?
The idea of that implementation is t use BitBlt as its bulk operation primitives; so it is optimized that way.
On Thu, Dec 14, 2023 at 3:57 PM <christoph.thiede(a)student.hpi.uni-potsdam.de> wrote:
Hi all,
just curious: Could there be a ultrafast and efficient BooleanArray or BitArray that subclasses from RawBitsArray, analogously to ByteArray et al.? With bytesPerElement ^ 1 / 8 and VM-supported conversion to ByteArray et al.? So far I only found Yoshiki's old BitArray from 2003 on SqueakMap, which uses a Bitmap internally and has some failing tests.
No actual need at the moment, just curious. And I think a modern implementation of that would be great to play with in the Trunk. :-)
Best, Christoph
Sent from Squeak Inbox Talk
-- -- Yoshiki
squeak-dev@lists.squeakfoundation.org