Interesting, can you please explain somewhat more?

On Saturday, September 21, 2013 3:19:16 AM UTC+4, Ambrose Bonnaire-Sergeant 
wrote:
>
> Just a thought, could implementing IKeywordInvoke and using keywords for 
> field lookups speed up compilation?
>
> Thanks,
> Ambrose
>
>
> On Fri, Sep 20, 2013 at 10:01 PM, Dmitry Groshev 
> <lambda...@gmail.com<javascript:>
> > 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 clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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

Reply via email to