<div dir="ltr">When a module is imported, or used for the first time, are there things that are not fully evaluated? <div><br></div><div>I see the same thing you do with the Data.Fixed methods (nice work by the way!), but I also see similar (albeit less drastic) behaviour with other datatypes, including some custom ones. It just always seems like the first call to a modules method is always slower than subsequent calls. But I can't for the life of me figure out why...</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 9, 2015 at 5:45 PM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a nice puzzle. However, I don't think it's related to IO.<br>
<br>
So far I've traced this to Data.Fixed methods. If you add<br>
<br>
  evaluate $ floor (2/1 :: Fixed E12)<br>
<br>
before the loop, you'll find that the delay decreases significantly<br>
(although doesn't vanish entirely).<br>
<br>
How is this related to forcing a time value? Well, UTCTime represents<br>
the time of day as Fixed E12, and when you're evaluating the result of<br>
getCurrentTime, you're calling those methods, (/) and floor.<br>
<br>
Using other methods of Fixed E12 before the loop, or replacing E12 with<br>
E9, kills or at least hurts the effect.<br>
<br>
There might be some thunks referenced directly or indirectly by those<br>
methods, possibly involving specialization, but I don't see it so far.<br>
<br>
I'll let someone else to take it from here.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 10/07/15 00:07, Ben Gunton wrote:<br>
> Here is the same thing with no console usage, just forcing the time<br>
> value. The first-iteration-delay seems to happen at the first IO-ish<br>
> thing being evaluated.<br>
><br>
> <a href="http://lpaste.net/136254" rel="noreferrer" target="_blank">http://lpaste.net/136254</a><br>
<br>
<br>
</div></div></blockquote></div><br></div>