Michael Van Canneyt wrote:
On Tue, 13 Nov 2007, Graeme Geldenhuys wrote:
* They tend to be slow compared no native types. In
Delphi 6 they were very slow. How does it compare
in FPC 2.2.0?
They are slower than native types, there is no way around this.
Almost each and every operation involving variants has some
implicit calls to variant support routines.
If the variant type is the correct type, no casts are done and the whole
thing is very quick.
You should see that it is more than double the size.
If that doesn't convince someone that variants are SLOW,
then I don't know what will. Use -al for compiler options.
Twice as big doesn't mean slow at all.
Most of the extra code covers different branches based on the variant
type, most of the extra code is NEVER used but there "in case" because,
as you say, pascal is a type safe language.
I would much rather have pascal manage the variant and conversions for
me than I have to manage it and get it wrong.
Sam
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives