[fpc-pascal] Bitpacked dynamic array support

denisgolovan denisgolovan at yandex.ru
Tue Dec 18 19:57:19 CET 2012


Hi Flávio

> You can use sets or TBits. Unless you mean packed arrays of byte or
> word, etc. In this case you just declare "myvar: packed array of
> byte".
> 
> -Flávio

I meant bitpacked arrays of boolean. That's when boolean occupies only one bit in memory.
Yes, I can use TBits, but unfortunately for operation that I care about it's not an option.

I attached the benchmark with numbers a sequential reading in a loop.
All in all TBits performance is really low. Currently it's about 150 times lower than QWord reading (near optimal on my machine)

Read from memory Array 1000000 elements
Read Byte        0.004380 sek   Speed,MB/sec =   217.73
Read Word        0.002950 sek   Speed,MB/sec =   646.56
Read DWord       0.004550 sek   Speed,MB/sec =   838.40
Read QWord       0.003943 sek   Speed,MB/sec =  1934.92
Read bitpacked   0.002745 sek   Speed,MB/sec =    43.43
Read TBits       0.009329 sek   Speed,MB/sec =    12.78 (!!!)

Test program attached.

 -- 
Regards,
Denis Golovan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testbits.tar.gz
Type: application/x-gzip
Size: 9905 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20121218/f5463e6d/attachment.bin>


More information about the fpc-pascal mailing list