<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-26 20:09 GMT+02:00 Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dave, as someone who works with large systems in Squeak, I&#39;m always<br>
interested in _storage efficiency_ as much as execution efficiency.<br>
<br>
DateAndTime, in particular, is a very common domain element with a<br>
high potential for there to be many millions of instances in a given<br>
domain model.<br>
<br>
Apps which have millions of objects with merely a Date attribute can<br>
canonicalize them.<br>
And, apps which have millions of Time objects can canonicalize them.<br>
<br>
But LargeInteger&#39;s are not easy to canonicalize (e.g.,<br>
utcMicroseconds).  So a database system with millions of DateAndTime&#39;s<br>
would have to do _two_ reads for every DateAndTime instance instead of<br>
just one today (because SmallIntegers are immediate, while<br>
LargeIntegers require their own storage buffer).<br>
<br>
One thing I really like about the current implementation of<br>
DateAndTime is how it carefully avoids LargeIntegers by having<br>
large-grained &quot;platforms&quot; to arrive at the current time.  e.g., each<br>
&#39;jdn&#39; is a chunk of (1000000*60*60*24) microseconds.  Your new<br>
implementation reflects an increase of 86 BILLION utcMicroseconds for<br>
every 1 jdn.<br>
<br>
Small, all-in-memory benchmarks may show faster with the LI, but I&#39;m<br>
concerned that large-scale apps might be significantly impacted in the<br>
opposite way..<br>
<br>
Would it be possible to re-optimize this part of the representation<br>
while still maintaining internal UTC represenation to solve your<br>
concern about daylight-savings?<br>
<br>
Thanks.<br></blockquote><div><br></div><div>That&#39;s more or less the Pharo path.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Sun, May 25, 2014 at 12:48 PM, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt; I have been working on a variation of class DateAndTime that replaces its<br>
&gt; instance variables (seconds offset jdn nanos) with two instance variables,<br>
&gt; utcMicroseconds to represent microseconds elapsed since the Posix epoch, and<br>
&gt; localOffsetSeconds to represent the local time zone offset. When instantiating<br>
&gt; the time now, A single call primitiveUtcWithOffset is used to obtain these<br>
&gt; two values atomically as reported by the underlying platform.<br>
&gt;<br>
&gt; There are several advantages to this representation of DateAndTime, the most<br>
&gt; important of which is that its magnitude is unambiguous regardless of daylight<br>
&gt; savings transitions in local time zones.<br>
&gt;<br>
&gt; This is my attempt to address some historical baggage in Squeak. The VM<br>
&gt; reports time related to the local time zone, and the image attempts to<br>
&gt; convert to UTC (sometimes incorrectly). A UTC based representation makes the<br>
&gt; implementation of time zone tables more straightforward (see for example<br>
&gt; the Olson time zone tables in TimeZoneDatabase on SqueakMap).<br>
&gt;<br>
&gt; I am attaching the source code as a SAR file that can be loaded into a fully<br>
&gt; updated Squeak trunk image. The conversion process is slow, so be patient<br>
&gt; if you load it.<br>
&gt;<br>
&gt; This can be run on either an intepreter VM or Cog, but if you use Cog, please<br>
&gt; use a version dated June 2013 or later (the VM in the Squeak 4.5 all-in-one<br>
&gt; is fine).<br>
&gt;<br>
&gt; I am also attaching a copy of LXTestDateAndTimePerformance, which can be<br>
&gt; used to compare the performance of some basic DateAndTime functions.<br>
&gt;<br>
&gt; Performance of the UTC based DateAndTime is generally favorable compared to<br>
&gt; the original. Here is what I see on my system (smaller numbers are better).<br>
&gt;<br>
&gt; LXTestDateAndTimePerformance test results using the original Squeak DateAndTime<br>
&gt; on an interpreter VM:<br>
&gt; {<br>
&gt;         #testNow-&gt;10143 .<br>
&gt;         #testEquals-&gt;30986 .<br>
&gt;         #testGreaterThan-&gt;80199 .<br>
&gt;         #testLessThan-&gt;75912 .<br>
&gt;         #testPrintString-&gt;10429 .<br>
&gt;         #testStringAsDateAndTime-&gt;44657<br>
&gt; }<br>
&gt;<br>
&gt; LXTestDateAndTimePerformance test results using the new UTC based DateAndTime<br>
&gt; on an interpreter VM:<br>
&gt; {<br>
&gt;         #testNow-&gt;6423 .<br>
&gt;         #testEquals-&gt;31625 .<br>
&gt;         #testGreaterThan-&gt;22999 .<br>
&gt;         #testLessThan-&gt;18514 .<br>
&gt;         #testPrintString-&gt;12502 .<br>
&gt;         #testStringAsDateAndTime-&gt;32912<br>
&gt; }<br>
&gt;<br>
&gt; (CC to Brent Pinkney, author of the excellent Squeak Chronology package)<br>
&gt;<br>
&gt; Dave<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div></div>