Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-12

Bitpacked dynamic array support

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

denisgolovan

Hi guys

It looks like currently FPC does not support dynamic bitpacked arrays. I wonder how much work it will take to make support for it?

For some things, it's a really useful functionality.

Regards, Denis Golovan
Flávio Etrusco
to denisgolovan

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

denisgolovan wrote 13 lines
Hi guys It looks like currently FPC does not support dynamic bitpacked arrays. I wonder how much work it will take to make support for it? For some things, it's a really useful functionality. -- Regards, Denis Golovan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
denisgolovan

Hi Flávio

Show quoted text 5 lines
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