On 01/21/2016 01:11 AM, Sven Barth wrote:

Am 20.01.2016 19:26 schrieb "Graeme Geldenhuys" <mailingli...@geldenhuys.co.uk <mailto:mailingli...@geldenhuys.co.uk>>:
>
> Is there a performance difference between using bitmask values and sets?

For sets with <= 32 elements it should behave the same if I remember correctly (I don't know right now though whether it would be 64 elements on 64-bit platforms though). With more elements there will be a penalty as then helper routines are needed. You cam check this by compiling with -al and comparing the assembler code. :)

>
> While we are on the topic of Sets. What is the maximum number of values
> you may have in a set, and does it differ between 32-bit and 64-bit
> platforms?

The maximum is currently 256 and it's the same on both platforms.

I think you can have even larger sets, but they are not supported by the RTTI functions and the FCL streaming system. Also, if you are using sets larger than 32 elements, the default value for {$packset} is not very optimal, as it will waste space for 256 elements, even if you need only 33. So, you're better off using something like {$packset 4}. The default setting is only kept for backward compatibility.

Nikolay
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to