Re:[fpc-pascal] Bitpacked dynamic array support

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re:[fpc-pascal] Bitpacked dynamic array support

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.

Denis Golovan
fpc-pascal maillist  -  [hidden email]

testbits.tar.gz (13K) Download Attachment