<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 22.02.2019 um 07:06 schrieb Paul van
Helden:<br>
</div>
<blockquote type="cite"
cite="mid:CAPjGFZdCr=BpyrHBcj-apo88cK7DceXM4Neer2DfMPSq-QGxAw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">On Fri, Feb 22, 2019 at 2:35 AM Ben Grasset <<a
href="mailto:operator97@gmail.com" moz-do-not-send="true">operator97@gmail.com</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, Feb 16, 2019
at 5:44 PM Benito van der Zander <<a
href="mailto:benito@benibela.de" target="_blank"
moz-do-not-send="true">benito@benibela.de</a>>
wrote</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div>
<div>it can turn out the enumerators are slower than
an old school loop</div>
</div>
</blockquote>
<div><br>
</div>
<div>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! </div>
</div>
</div>
<br>
</blockquote>
<div> 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).</div>
</div>
</div>
</blockquote>
Just as you would a class (an object is fine, too, by the way). You
can take a look at the testcase here:
<a class="moz-txt-link-freetext" href="https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/test/tforin25.pp?view=markup">https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/test/tforin25.pp?view=markup</a><br>
<br>
Regards,<br>
Sven<br>
</body>
</html>