<div dir="ltr">Hi Chrises,<div><br></div><div>    my vote would be to write these as 12 numbered primitives, (2,4 &amp; 8 bytes) * (at: &amp; at:put:) * (big &amp; little endian) because they can be performance critical and implementing them like this means the maximum efficiency in both 32-bit and 64-bit Spur, plus the possibility of the JIT implementing the primitives.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 30, 2015 at 10:01 PM, Chris Cunningham <span dir="ltr">&lt;<a href="mailto:cunningham.cb@gmail.com" target="_blank">cunningham.cb@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Chris,<div><br></div><div>I&#39;m all for having the fastest that in the image that works.  If you could make your version handle endianess, then I&#39;m all for including it (at least in the 3 variants that are faster).  My first use for this (interface for KAFKA) apparently requires bigEndianess, so I really want that supported.</div><div><br></div><div>It might be best to keep my naming, though - it follows the name pattern that is already in the class.  Or will yours also support 128?</div><div><br></div><div>-cbc</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 30, 2015 at 2:38 PM, Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris, I think these methods belong in the image with the fastest<br>
implementation we can do.<br>
<br>
I implemented 64-bit unsigned access for Ma Serializer back in 2005.<br>
I modeled my implementation after Andreas&#39; original approach which<br>
tries to avoid LI arithmetic.  I was curious whether your<br>
implementations would be faster, because if they are then it could<br>
benefit Magma.  After loading &quot;Ma Serializer&quot; 1.5 (or head) into a<br>
trunk image, I used the following script to take comparison<br>
measurements:<br>
<br>
| smallN largeN maBa cbBa |  smallN := ((2 raisedTo: 13) to: (2<br>
raisedTo: 14)) atRandom.<br>
largeN := ((2 raisedTo: 63) to: (2 raisedTo: 64)) atRandom.<br>
maBa := ByteArray new: 8.<br>
cbBa := ByteArray new: 8.<br>
maBa maUint: 64 at: 0 put: largeN.<br>
cbBa unsignedLong64At: 1 put: largeN bigEndian: false.<br>
self assert: (cbBa maUnsigned64At: 1) = (maBa unsignedLong64At: 1<br>
bigEndian: false).<br>
{ &#39;cbc smallN write&#39; -&gt; [ cbBa unsignedLong64At: 1 put: smallN<br>
bigEndian: false] bench.<br>
&#39;ma smallN write&#39; -&gt; [cbBa maUint: 64 at: 0 put: smallN ] bench.<br>
&#39;cbc smallN access&#39; -&gt; [ cbBa unsignedLong64At: 1 bigEndian: false. ] bench.<br>
&#39;ma smallN access&#39; -&gt; [ cbBa maUnsigned64At: 1] bench.<br>
&#39;cbc largeN write&#39; -&gt; [ cbBa unsignedLong64At: 1 put: largeN<br>
bigEndian: false] bench.<br>
&#39;ma largeN write&#39; -&gt; [cbBa maUint: 64 at: 0 put: largeN ] bench.<br>
&#39;cbc largeN access&#39; -&gt; [ cbBa unsignedLong64At: 1 bigEndian: false ] bench.<br>
&#39;ma largeN access&#39; -&gt; [ cbBa maUnsigned64At: 1] bench.<br>
 }<br>
<br>
Here are the results:<br>
<br>
&#39;cbc smallN write&#39;-&gt;&#39;3,110,000 per second.  322 nanoseconds per run.&#39; .<br>
&#39;ma smallN write&#39;-&gt;&#39;4,770,000 per second.  210 nanoseconds per run.&#39; .<br>
&#39;cbc smallN access&#39;-&gt;&#39;4,300,000 per second.  233 nanoseconds per run.&#39; .<br>
&#39;ma smallN access&#39;-&gt;&#39;16,400,000 per second.  60.9 nanoseconds per run.&#39; .<br>
&#39;cbc largeN write&#39;-&gt;&#39;907,000 per second.  1.1 microseconds per run.&#39; .<br>
&#39;ma largeN write&#39;-&gt;&#39;6,620,000 per second.  151 nanoseconds per run.&#39; .<br>
&#39;cbc largeN access&#39;-&gt;&#39;1,900,000 per second.  527 nanoseconds per run.&#39; .<br>
&#39;ma largeN access&#39;-&gt;&#39;1,020,000 per second.  982 nanoseconds per run.&#39;<br>
<br>
It looks like your 64-bit access is 86% faster for accessing the<br>
high-end of the 64-bit range, but slower in the other 3 metrics.<br>
Noticeably, it was only 14% as fast for writing the high-end of the<br>
64-bit range, and similarly as much slower for small-number access..<br>
<div><div><br>
<br>
On Fri, Aug 28, 2015 at 6:01 PM, Chris Cunningham<br>
&lt;<a href="mailto:cunningham.cb@gmail.com" target="_blank">cunningham.cb@gmail.com</a>&gt; wrote:<br>
&gt; Hi.<br>
&gt;<br>
&gt; I&#39;ve committed a change to the inbox with changes to allow getting/putting<br>
&gt; 64bit values to ByteArrays (similar to 32 and 16 bit accessors).  Could this<br>
&gt; be added to trunk?<br>
&gt;<br>
&gt; Also, first time I used the selective commit function - very nice!  the<br>
&gt; changes I didn&#39;t want committed didn&#39;t, in fact, get commited.  Just the<br>
&gt; desirable bits!<br>
&gt;<br>
&gt; -cbc<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div>
</div></div><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div>