Re: Performance trouble with Processing jar

2014-03-29 Thread tamichan
Thanks Adam

(def applet (new PApplet)) -> (def ^PApplet (new PApplet))  results in 
amazing speed!

And, quil certainly uses these type hints, sorry.
In this trouble, I learned the principle of using type hints for much java 
method call.

Ideally I wish clojure compiler may automatically add type when using (new 
...).


2014年3月29日土曜日 23時28分29秒 UTC+9 Adam Clements:
>
> Have you got type hints? If you do a java method call on something which 
> isn't type hinted then clojure has to use reflection to look up a list of 
> the available methods, which is slw. If however you tell it what type 
> you expect it to be, it can better optimise it. So in the above code you 
> would have something more like (defn draw [^Applet applet] (.line applet 
> ))
>
> Look up how to turn on reflection warnings in your project and that will 
> highlight all the lines which need attention.
>
> Hopefully it's as simple as that, but I would have expected quil to have 
> type hints already, so possibly not...
>
> Adam
>
>
> Adam
>
>
> On Sat, Mar 29, 2014 at 6:20 AM, tamichan 
> > wrote:
>
>> Hi All
>>
>> I'm writing graphic clojure code with Processing jars.
>> When I wrote heavy draw code, I found clojure code is slower than an 
>> equivalent of java.
>>
>> Probably, the cause is java method call.
>> I call processing drawing method thousands times per one frame. 
>> (.line applet x1 y1 z1 x2 y2 z2)
>>
>> So decrease the call count, increase draw performance.
>> Do you know anything speed up way of java method call?
>>
>> I tied quil, but it was same performance.
>> clojure version is 1.5.1
>>
>> thanks
>>
>> -- 
>> 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
>> 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 
>> 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 .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/d/optout.


Performance trouble with Processing jar

2014-03-29 Thread tamichan
Hi All

I'm writing graphic clojure code with Processing jars.
When I wrote heavy draw code, I found clojure code is slower than an 
equivalent of java.

Probably, the cause is java method call.
I call processing drawing method thousands times per one frame. 
(.line applet x1 y1 z1 x2 y2 z2)

So decrease the call count, increase draw performance.
Do you know anything speed up way of java method call?

I tied quil, but it was same performance.
clojure version is 1.5.1

thanks

-- 
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/d/optout.