does doing an unchecked cast of the return value of the aget on the byte
array change things?

(defn test-fn
        []
        (let [obj-ary (object-array 10)
              byte-data (byte-array (range 10))]
          (doseq [idx (range 10)]
            (let [idx (int idx)]
              (aget obj-ary idx
                    (bit-and 0xFF (unchecked-long (aget byte-data
idx))))))))

This disassembled clearer and I think dropped the long cast.

On Wed, Jan 30, 2019 at 3:03 PM Brian Craft <craft.br...@gmail.com> wrote:

> Profiling is showing a lot of time spent in RT.longCast, in places like
> this:
>
> (aget flat-dict (bit-and 0xff (aget arr j)))
>
> arr is hinted as ^bytes, and flat-dict as ^objects.
>
> which compiles to this:
>
> Object code2 = RT.aget((Object[])flat_dict, RT.intCast(0xFFL &
> RT.longCast((Object)RT.aget((byte[])arr2, RT.intCast(k)))))
>
> Is there any way to avoid that RT.longCast? There is an aget method in
> RT.java that returns a byte, and a longCast for byte, but I suspect the
> cast to Object is causing it to hit the longCast for Object, which does a
> bunch of reflection.
>
> --
> 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