I updated my answer on SO, with a deftype-based one that gives me an
additional 30% boost.


On Tue, Feb 19, 2013 at 6:38 PM, Geo <ggrigor...@gmail.com> wrote:

> What about the call to .equals?
>
>
> On Tuesday, February 19, 2013 12:20:28 PM UTC-5, Marko Topolnik wrote:
>>
>> The difference between String[] and Object[] is that a member of the
>> former doesn't need a checked cast to String, but the latter does need one.
>> In the code under consideration, however, nothing specific to String is
>> used, so even in the Java code you can freely replace String[] with
>> Object[] and everything still works.
>>
>> If, on the other hand, you needed to invoke say *substring*, you'd see a
>> small penalty due to the checked cast operation.
>>
>> On Tuesday, February 19, 2013 5:52:31 PM UTC+1, Andy Fingerhut wrote:
>>>
>>> ^objects is a Clojure synonym for ^"[Ljava.lang.Object;".  Note that
>>> there are such synonyms for only a few Java types, not everything, e.g.
>>> there is no ^strings.
>>>
>>> What you are hinting is that a1 and a2 are Java arrays of objects.  I
>>> think this might speed up (aget a1 i) expressions, since it is known that
>>> a1 is an array of objects, but I'm not sure about that.  I believe "under
>>> the hood" in the JVM all arrays of Objects are treated the same, regardless
>>> of whether those Objects are String, Integer, java.awt.Color, etc.
>>>
>>> Andy
>>>
>>> On Feb 19, 2013, at 8:46 AM, Geo wrote:
>>>
>>> One thing I don't get is that switching the type hints from
>>>
>>> [#^"[Ljava.lang.String;" a1 #^"[Ljava.lang.String;" a2]
>>>
>>> to [^objects a1 ^objects a2] didn't seem to have any negative impact on
>>> performance. Can anyone explain why hinting ^objects is just as good as
>>> specifying that it's an array of Strings? What are you hinting with
>>> ^objects that Clojure doesn't already know?
>>>
>>>  --
> --
> 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/groups/opt_out.
>
>
>



-- 
On Clojure http://clj-me.cgrand.net/
Clojure Programming http://clojurebook.com
Training, Consulting & Contracting http://lambdanext.eu/

-- 
-- 
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/groups/opt_out.


Reply via email to