Forum > General

Sets of LongInt

<< < (2/3) > >>

Martin_fr:
@Spribo:

using TBits indeed is as similar to a set as you can get (and also the fastest implementation (equal to perfect hash) O=1),
but if Spribo uses some very big longint, then it comes at the cost of high memory usage.

@befelemepeseveze:
Unless I missed a critical point: TFPGMap seems to be based on a list implementation with key/value pairs. Therefore using it, is as good/bad as using a normal list.
Operations on the list can be potentially slow.

Spribo:
I will certainly use TBits... As the biggest LongInt I will store will be 50000000.

Spribo:
When I try to create a TBit with size 1000000 (myarray:=TBit.Create(1000000)), it raises error (EBitsError), and says that the index of bit has exceeded the size limit. Why?

bflm:

--- Quote from: Martin_fr on July 17, 2010, 10:07:09 pm ---@befelemepeseveze:
Unless I missed a critical point: TFPGMap seems to be based on a list implementation with key/value pairs. Therefore using it, is as good/bad as using a normal list.
Operations on the list can be potentially slow.

--- End quote ---

Sure. I thought the problem is the large sparsity of the set which the map solves nicely and in a memory efficient way. TBits is definitely the fast path but wastes a lot of memory with sets like {1, 1000000, <<other thousand members>>, 50000000} (cf. one of the other Spiro's post above) where the mem usage diff is pretty big (~6MB vs few tens of kB per set instance).

Spribo:
But could you tell me why it raises that error? And where could I find documentation on unit fgl?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version