[fpc-devel] "Blank slate" next version of FPC
Sven Barth
pascaldragon at googlemail.com
Fri Feb 22 07:31:40 CET 2019
Am 22.02.2019 um 07:06 schrieb Paul van Helden:
> On Fri, Feb 22, 2019 at 2:35 AM Ben Grasset <operator97 at gmail.com
> <mailto:operator97 at gmail.com>> wrote:
>
>
> On Sat, Feb 16, 2019 at 5:44 PM Benito van der Zander
> <benito at benibela.de <mailto:benito at benibela.de>> wrote
>
> it can turn out the enumerators are slower than an old school loop
>
>
> The trick with enumerators is to never make them classes, and use
> advanced records instead, I've found. This way you avoid the heap
> allocation and the implicit try/finally. Also make sure you inline
> the MoveNext and GetCurrent!
>
> How do you make a (for in) enumerator with a record? I don't use them
> for exactly this reason, and they did seem to be another useful
> language feature that turned out to be poorly implemented by
> Embarcadero. (Haven't checked with FPC).
Just as you would a class (an object is fine, too, by the way). You can
take a look at the testcase here:
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/test/tforin25.pp?view=markup
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190222/cfeb0efe/attachment.html>
More information about the fpc-devel
mailing list