Re: Type hinting question

2011-02-14 Thread Stuart Sierra
Thanks, Johan! -S -- 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, s

Re: Type hinting question

2011-02-14 Thread Johan Wirde
On Java HotSpot: -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly You'll need quite a few iterations, and be wary of code with no observable effect (becomes subject to dead code elimination). As far as I could tell cast or no cast made no difference at all (in this particular case). /Johan Wir

Re: Type hinting question

2011-02-13 Thread Stuart Sierra
Modern JVMs like HotSpot are very good at eliminating unnecessary instructions. Unfortunately, I haven't heard of a good tool for observing this process, so you either have to take it on faith or go read the OpenJDK source code. -Stuart Sierra clojure.com -- You received this message because

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 10:43 PM, Mikhail Kryshen wrote: > Java SDK includes javap bytecode disassembler. And you can compile Java > without creating project structure. Not with an IDE. You have to resort to poking around at a commandline and using a normal editor, and then you lose syntax highli

Re: Type hinting question

2011-02-12 Thread Mikhail Kryshen
Java SDK includes javap bytecode disassembler. And you can compile Java without creating project structure. $ emacs Test.java $ javac Test.java $ javap -c Test Results: public class Test { public static String hello() { final StringBuilder sb = new StringBuilder(); sb.append

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 9:42 PM, Ken Wesson wrote: > Frak. I tried a cleverish way to maybe answer that question from > within Clojure, basically by seeing if a deliberately bad assignment > threw on the assignment or only when the thing got used. > > Specifically, I used this: > > (let [^String k

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 9:35 PM, Ken Wesson wrote: > I rarely have more questions than answers here, but this is one of > those times, and it has to do with efficiency. > > Is the bytecode generated from > > (let [^StringBuilder sb (StringBuilder.)] >  (.append sb "Hello, ") >  (.append sb "world"