FWIW I observed the same thing profiling 1.5.1 with Yourkit a couple months ago and tried adding caching to the Clojure compiler, but I wasn't able to get any speedup. It wasn't clear to me if I messed something up, or if the profiler was just lying about where the execution time was actually going.
On Friday, September 20, 2013 7:01:39 AM UTC-7, Dmitry Groshev wrote: > > In this mail I'm talking about Clojure 1.4, however, I believe that the > issue persists in later versions, too. > > I have quite a lot of code of the following form: > > (defprotocol sum-proto > (sum [x y])) > > (deftype Pair > [^long a ^long b] > sum-proto > (sum [x y] > (let [^Pair y y > new-a (+ (.a x) (.a y)) > new-b (+ (.b x) (.b y))] > (Pair. new-a new-b)))) > > In real code there are *a lot* of implementations in that deftype > generated by macroses. The problem is that compilation time skyrocketed. > Right now I'm facing 5-10 seconds of compilation, which makes incremental > development very painful. Profiler shows that the overwhelming majority of > this time is spent here: [1]. It follows that the problem is in that ^Pair > annotation: when symbol is tagged by a symbol, it should be resolved as a > class. It should be way faster if I can "cache" that resolution, but I > can't given that those implementation are inside of deftype, I can't > resolve in advance the class that isn't defined. And I can't use > extend-type either because of the cost of extra var lookup. > > The main question is: what can I do to make compilation faster? > Pre-resolving that class won't work, it seems. > > [1]: > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L986 > -- -- 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.