<font face="verdana, sans-serif">Thanks a lot!</font><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">I&#39;ve updated the benchmark accordingly, and have released a new version without the 1.3x slowdown disclaimer as generic-hashable 1.1.8.</font></div>

<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">  - Clark</font></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 4, 2012 at 10:25 AM, Herbert Valerio Riedel <span dir="ltr">&lt;<a href="mailto:hvr@gnu.org" target="_blank">hvr@gnu.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Clark Gaebel &lt;<a href="mailto:cgaebel@uwaterloo.ca">cgaebel@uwaterloo.ca</a>&gt; writes:<br>
<br>
[...]<br>
<div class="im"><br>
&gt; Oh yeah, and if anyone wants to help me figure out why it&#39;s 1.3x slower<br>
&gt; than my hand-rolled instances, that would be really helpful.<br>
<br>
</div>[...]<br>
<br>
I&#39;ve taken a look at the bench/Bench.hs benchmark[1]:<br>
<br>
The generated Core looks almost[2] the same as your &#39;HandRolled&#39;; but<br>
the 1.3x slow-down factor seems to be caused by the way the<br>
&#39;bigGenericRolledDS&#39; CAF is defined in the test-harness: if I define it<br>
explicitly (i.e. just as &#39;bigHandRolledDS&#39; is defined, and not as an<br>
isomorphic transformation of the &#39;bigHandRolledDS&#39; value) the benchmark<br>
results in both versions having more or less equal performance as would<br>
be expected.<br>
<br>
<br>
 [1]: <a href="https://github.com/wowus/hashable-generics/blob/master/bench/Bench.hs" target="_blank">https://github.com/wowus/hashable-generics/blob/master/bench/Bench.hs</a><br>
<br>
 [2]: with the following change, it would look exactly the same (modulo<br>
      alpha renamings):<br>
<br>
--8&lt;---------------cut here---------------start-------------&gt;8---<br>
--- a/bench/Bench.hs<br>
+++ b/bench/Bench.hs<br>
@@ -18,7 +18,7 @@ data GenericRolled = GR0<br>
     deriving Generic<br>
<br>
 instance Hashable HandRolled where<br>
-    hashWithSalt salt HR0       = hashWithSalt salt $ (Left () :: Either () ())<br>
+    hashWithSalt salt HR0       = hashWithSalt salt $ ()<br>
     hashWithSalt salt (HR1 mi)  = hashWithSalt salt $ (Right $ Left mi :: Either () (Either (Maybe Int) ()))<br>
     hashWithSalt salt (HR2 x y) = hashWithSalt salt $ (Right $ Right (x, y) :: Either () (Either () (HandRolled, HandRolled)))<br>
--8&lt;---------------cut here---------------end---------------&gt;8---<br>
<br>
hth,<br>
hvr<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>