[fpc-pascal] A question about sets performance

Marco van de Voort marcov at stack.nl
Mon Jan 31 22:58:56 CET 2011


In our previous episode, Vladimir Zhirov said:
> I was surprised when B turned out to be almost 3 times
> slower than A (~11 vs ~29 sec. on my hardware). This ratio
> remains nearly the same regardless of compiler optimization
> level.

This is normal. Typed constants are considered variables, and not optimized.

There is a third variant, constant sets

  C)
    const someset = ['A','B','C'); // true constant set
 
> I'm using FPC 2.4.2 [2010/12/27] for i386 on Linux.
> 
> 1) Is it expected behavior, or should I create 
>    a bug report about it?
> 2) What way (A or B) are you using in your programs 
>    (or would suggest to use in long term)?
  
 A or C



More information about the fpc-pascal mailing list