Did I see a thread a while ago where doing this caught some people out 
because it wiped out some other performance switches?  I can't find the 
thread.

Apologies if I am spreading FUD....

On Wednesday, 5 February 2014 23:05:18 UTC, Alex Miller wrote:
>
> To override the default tiered compilation, add this to your project.clj:
>
> :jvm-opts ^:replace []
>
> I would also recommend using a newer JDK (preferably 7, but at least 6). 
>
>
> On Wednesday, February 5, 2014 4:34:12 PM UTC-6, David Nolen wrote:
>>
>> You need to make sure that you are running with server settings. If you 
>> are using lein, it's likely that this is not the case unless you have 
>> overridden lein's defaults in your project.clj.
>>
>>
>> On Wed, Feb 5, 2014 at 5:30 PM, Glen Fraser <hola...@gmail.com> wrote:
>>
>>> Thanks, yes, the version starting with 0.0 in the loop (rather than 0) 
>>> does run faster.  In my case, about 13% faster (19.7 seconds -- for the 
>>> code you pasted below, with *unchecked-math*, type hints and starting x of 
>>> 0.0 -- vs 22.7 seconds for my original version).  But if you start with x 
>>> of 0 (integer), the type-hinted version runs notably slower.  In all cases, 
>>> though, at least you get the same final answer… (-;
>>>
>>> So I don't see that 50% speedup you're seeing, but I do see improvement. 
>>>  I'm on Clojure 1.5.1, and Java 1.7.0_51 on OS X 10.8.5, running in an 
>>> nREPL (cider) in Emacs.  Possibly other JDK versions have more 
>>> optimizations?
>>>
>>> Thanks
>>> Glen.
>>>
>>> On Feb 5, 2014, at 10:56 PM, David Nolen <dnolen...@gmail.com> wrote:
>>>
>>> (set! *unchecked-math* true)
>>> (defn g ^double [^double x] (+ (Math/sin (* 2.3 x)) (Math/cos (* 3.7 
>>> x))))
>>> (time (loop [i 100000000 x 0.0] (if (pos? i) (recur (dec i) (g x)) x)))
>>>  
>>> This is nearly 50% faster than the original version on my machine. Note 
>>> that x is bound to 0.0 in the loop, which allows the optimized g to be 
>>> invoked.
>>>
>>>
>>> On Wed, Feb 5, 2014 at 4:41 PM, Glen Fraser <hola...@gmail.com> wrote:
>>>
>>>> Thanks to both of you for these suggestions, they're good to know.  In 
>>>> my specific case, setting the *unchecked-math* flag true did indeed speed 
>>>> things up slightly (by about 6%).  The other change, though, with the 
>>>> double type hints (I assume that's what those are), actually ran notably 
>>>> slower (over 20% slower!).
>>>>
>>>> Glen.
>>>>
>>>> On Feb 5, 2014, at 8:13 PM, David Nolen <dnolen...@gmail.com> wrote:
>>>>
>>>> Also:
>>>>
>>>> (defn g ^double [^double x] (+ (Math/sin (* 2.3 x)) (Math/cos (* 3.7 
>>>> x))))
>>>>
>>>>
>>>> On Wed, Feb 5, 2014 at 2:07 PM, Alex Miller <al...@puredanger.com>wrote:
>>>>
>>>>> Others have answered with many useful bits but I would mention that it 
>>>>> would possibly make a significant performance difference if you added 
>>>>> this 
>>>>> to your code:
>>>>>
>>>>> (set! *unchecked-math* true)
>>>>>
>>>>>
>>>>>>
>>>>
>>>  -- 
>>> 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/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