Case : clojure verison:
(time (dotimes [n 10000000] (str n "another word"))) ;; take about 5000msec java version long time = System.nanoTime(); for(int i=0 ; i<10000000 ;i++){ String a=i+"another word"; } System.out.println(System.nanoTime()-time); The java version take about 500 msecs, I thought it might be caused by the str implementation which is using string builder, and it might not be the best choice in the case of no much string to concat, and then I replace "another word" with 5 long strings as the parameter, however no surprise. I just wonder what make the difference, or how to find the difference. Thanks On Saturday, March 1, 2014 1:26:38 PM UTC+8, Shantanu Kumar wrote: > > I have seen (and I keep seeing) a ton of Java code that performs poorly. > Empirically, it's equally easy to write a slow Java app. You always need a > discerning programmer to get good performance from any language/tool. > > Numbers like 1/4 or 1/10 can be better discussed in presence of the > use-cases and perf test cases. Most of the problems you listed can be > mitigated by `-server` JIT, avoiding reflection, transients, loop-recur, > arrays, perf libraries and some Java code. > > Shantanu > -- 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.