On Sunday, November 4, 2012 11:41:23 AM UTC+1, Satoru Logic wrote:
>
>
>
> On Sunday, November 4, 2012 6:20:37 PM UTC+8, Marko Kocić wrote:
>>
>> I get big fluctuation in results for bot naive-into and into, ranging
>> from 400ms to 1500ms.
>> This is probably because of the GC kicking in and influencing timings.
>>
>> Changing timings to something like:
>> (System/gc) (time (do (into #{} (range 1e6)) nil))
>> and
>> (System/gc) (time (do (naive-into #{} (range 1e6)) nil))
>> gives much more consistent results with almost no variance, and on my box
>> I get ~380 for into, and ~580 for naive-into
>>
>
> I still can't get consistent results with this.
>
> BTW, what does System/gc do, I can't use `doc` on it.
>
>
System/gc is a call to Java System.gc() which basically hints the JVM to
run garbage collector. Whether it will actually run it depends on many
factors, like your java version, various GC settings and memory settings.
If you don't specify those settings on the cmdline, java decides on its own
based on your system. It is quite possible that it just has to trigger
garbage collector during execution of timing on your system, while it
doesn't have to on my system. I'm running jdk 1.7 on 64bit linux, btw.
You can find more details of GC tuning here:
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
Cheers,
Marko
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en