It's not just to facilitate inlining, but also to limit the perf hit
for hashing non-collections, some of which make completely reasonable
map keys and set members. I've used the classes Alex Miller mentioned
he was interested in for benchmarking: Class, Character, Var; these
are all good examples, and only one is under Clojure's control.

I used a "map or map entry or collection" test in earlier versions of
the patch, but switched to the class name hack because the three-way
type check seems to slow down getting to the default case much more
than examining the class name. For types that actually implement
IHashEq, however, the original patch was faster, so I think HotSpot is
happy to inline either version.


On 13 May 2014 14:00, Mike Fikes <mikefi...@me.com> wrote:
> To facilitate inlining, the patch calls out to a separate larger method
> which handles a group of cases.
>
> +        if(o.getClass().getName().startsWith("java.util."))
> +                return doalienhasheq(o);
> +        return o.hashCode();
>
>
> I was wondering whether an efficient improvement is possible that would
> support things like Guava ImmutableList.
>
>
> In particular, I was wonder which "default" cases are currently handled by
> the return o.hashCode() above. Replacing the three lines above with
>
>
> +        return doalienhasheq(o);
>
>
> would allow the patch to also handle non-java.util collection
> implementations, but push the "default" cases down into the bottom of that
> method.
>
>
> On Tuesday, May 13, 2014 12:38:54 AM UTC-4, Michał Marczyk wrote:
>>
>> I've posted a patch that makes java.util.{List,Map,Map.Entry,Set}
>> hashes consistent with those of appropriate Clojure collection types
>> on the ticket.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to