Thread overview |
---|
September 17, 2009 std.bitarray | ||||
---|---|---|---|---|
| ||||
I understand a bitarray being faster than a boolean array as the first uses bitwise (hardware) operators. Is this a correct understanding of the situation? Why then is a boolean array not implemented in that way? I expect there to be a good reason which I just don't know. I'd like to be able to bit shift and test a large (1024) array of bits as fast as possible (runs thousands of times per iteration). Should I go with the bitarray (I don't see the shift and test functions) or create my own bitarray somehow using intrinsics? I'd rather use existing implementations, but if the speed is a factor off or something.. |
September 18, 2009 Re: std.bitarray | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saaa | Hello Saaa,
> I understand a bitarray being faster than a boolean array as the first
> uses
> bitwise (hardware) operators.
> Is this a correct understanding of the situation?
> Why then is a boolean array not implemented in that way?
Because you can't slice a bit array the same way you can slice a int or byte array. D used to have a bit type and bit arrays where primitives but it made for all kinds of problems when you wanted to do slices.
|
September 18, 2009 Re: std.bitarray | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS |
Ah, slicing, of course, thanks!
> Hello Saaa,
>
>> I understand a bitarray being faster than a boolean array as the first
>> uses
>> bitwise (hardware) operators.
>> Is this a correct understanding of the situation?
>> Why then is a boolean array not implemented in that way?
>
> Because you can't slice a bit array the same way you can slice a int or byte array. D used to have a bit type and bit arrays where primitives but it made for all kinds of problems when you wanted to do slices.
>
>
|
September 18, 2009 Re:[OT] std.bitarray | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saaa | Could you /please/ include the "reply to" line in the text of your posts. Most clients seem to add it by default and it makes it much easier for people to find replies to there posts. (I have a filter set up to mark post with my username so, in my case I'd guess that without that line, I'm about 3-5 times more likely to not see a reply.)
BTW the following line is the "reply to" line:
Hello Saaa,
> Ah, slicing, of course, thanks!
>
>> Hello Saaa,
>>
>>> I understand a bitarray being faster than a boolean array as the
>>> first
>>> uses
>>> bitwise (hardware) operators.
>>> Is this a correct understanding of the situation?
>>> Why then is a boolean array not implemented in that way?
>> Because you can't slice a bit array the same way you can slice a int
>> or byte array. D used to have a bit type and bit arrays where
>> primitives but it made for all kinds of problems when you wanted to
>> do slices.
>>
|
September 18, 2009 Re: Re:[OT] std.bitarray | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS, Thanks for pointing that out. I'll keep to that convention in my next posts. |
Copyright © 1999-2021 by the D Language Foundation