On Sat, Feb 12, 2011 at 8:28 AM, timc <timgcl...@gmail.com> wrote:
> Further investigation reveals that
>
> (def b (byte i))
>
> is doing something equivalent to this internally:
>
> byte b = Byte.parseByte(String.format("%d",i));

What the HELL?

That's incredibly icky and inefficient. :)

Why not

if (i < 128 || i > 127)
  throw something;
else
  b = (byte)i;

which still bounds-checks the conversion but has got to be orders of
magnitude faster?

-- 
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

Reply via email to