<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-27 4:30 GMT+02:00 Chris Muller <span dir="ltr">&lt;<a href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The issue actually relates purely to Squeak domain models.  Consider<br>
the case of an all-in-memory object model in Squeak, with no database<br>
involved at all.  It is very feasible an app would want to import a<br>
flat-file dataset that involves creation a few million DateAndTime<br>
instances (along with other objects, of course) to the point where<br>
memory constraints begin to be noticed.<br>
<br>
When dealing with this level of prolifigation-potential of a<br>
particular class, and for such a base data-type we don&#39;t want to<br>
endure changing again, I want us to strongly scrutinize the internal<br>
representation.<br>
<br>
In this case, the use of &#39;utcMicroseconds&#39; introduces a lot of<br>
duplicate bit-patterns in memory that are very hard, if not<br>
impossible, to share.<br>
<br>
The simplest case are two equivalent instances of DateAndTime (read<br>
from separate files).  Despite being equivalent, their<br>
utcMicroseconds&#39; will be separate objects each consuming separate<br>
memory space.  There is no easy way to share the same<br>
&#39;utcMicroseconds&#39; instance between them.<br>
<br>
But fully-equivalent DateAndTime&#39;s is not even half of the concern --<br>
the high-order bits of every DateAndTime&#39;s &#39;utcMicroseconds&#39;<br>
duplicates the same bit pattern, again and again, eating up memory.<br>
<br>
That doesn&#39;t happen when the internal representations are, or can be,<br>
canonicalized, as in the case of using SmallIntegers.  Yes, Brent&#39;s<br>
original representation requires two additional slots per instance,<br>
but the _contents_ of those slots are SmallIntegers -- shared memory.<br>
<div class=""><div class="h5"><br></div></div></blockquote><div><br>Well, in current 32 bit image format, SmallInteger are not exactly shared, they are immediate values.<br></div><div>Each consumes exactly 32 bits.<br><br>
</div><div>For a compact class like LargePosOrNegInteger, I don&#39;t remember what is the header size exactly, but you get 64 bits for data, I would be surprised to see a major difference wrt consumed memory.<br><br></div>
<div>Nicolas<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">
<br>
On Mon, May 26, 2014 at 8:29 PM, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt; On Mon, May 26, 2014 at 01:09:06PM -0500, Chris Muller wrote:<br>
&gt;&gt; Hi Dave, as someone who works with large systems in Squeak, I&#39;m always<br>
&gt;&gt; interested in _storage efficiency_ as much as execution efficiency.<br>
&gt;&gt;<br>
&gt;&gt; DateAndTime, in particular, is a very common domain element with a<br>
&gt;&gt; high potential for there to be many millions of instances in a given<br>
&gt;&gt; domain model.<br>
&gt;&gt;<br>
&gt;&gt; Apps which have millions of objects with merely a Date attribute can<br>
&gt;&gt; canonicalize them.<br>
&gt;&gt; And, apps which have millions of Time objects can canonicalize them.<br>
&gt;&gt;<br>
&gt;&gt; But LargeInteger&#39;s are not easy to canonicalize (e.g.,<br>
&gt;&gt; utcMicroseconds).  So a database system with millions of DateAndTime&#39;s<br>
&gt;&gt; would have to do _two_ reads for every DateAndTime instance instead of<br>
&gt;&gt; just one today (because SmallIntegers are immediate, while<br>
&gt;&gt; LargeIntegers require their own storage buffer).<br>
&gt;<br>
&gt; Hi Chris,<br>
&gt;<br>
&gt; I do not have a lot of experience with database systems, so I would<br>
&gt; like to better understand the issue for storage of large numeric values.<br>
&gt;<br>
&gt; I was under the impression that modern SQL databases provide direct<br>
&gt; support for large integer data types (e.g. bigint for SQL server), and my<br>
&gt; assumption was that object databases such as Magma or GemStone would<br>
&gt; make this a non-issue. Why is it that a large (64 bit) integer should<br>
&gt; be any more or less difficult to persist than a small integer?<br>
&gt;<br>
&gt; This may be a dumb question but I am curious.<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Dave<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div></div>