Ubuntu 12.04, java 6 32 bits....

Luc P.


> This is weird...for just 2 operations I'm getting consistently better 
> timings with persistent than transients...
> 
> user=> (time (dotimes [_ 1000000] (assoc [1 2 3 4 5 6 7 8 9 0] 3 5 6 8)))
> "Elapsed time: 240.247405 msecs"
> nil
> user=>
> user=> (time (dotimes [_ 1000000] (persistent! (assoc! (transient [1 2 3 
> 4 5 6 7 8 9 0]) 3 5 6 8))))
> "Elapsed time: 354.122806 msecs"
> nil
> user=> (time (dotimes [_ 1000000] (assoc [1 2 3 4 5 6 7 8 9 0] 3 5 6 8)))
> "Elapsed time: 188.765493 msecs"
> nil
> user=> (time (dotimes [_ 1000000] (persistent! (assoc! (transient [1 2 3 
> 4 5 6 7 8 9 0]) 3 5 6 8))))
> "Elapsed time: 318.90242 msecs"
> nil
> 
> Jim
> 
> ps: are you guys on java 1.7 ?
> 
> On 09/11/12 02:29, Softaddicts wrote:
> > Roughly... My FPU module is slow tonight....
> >
> >
> >> My own tests shows that the transient version is twice as fast:
> >>
> >> (time (dotimes [_ 1000000] (assoc [1 2 3 4 5 6 7 8 9 0] 3 5 6 8)))
> >> Elapsed time: 711.848312 msecs
> >>
> >> (time (dotimes [_ 1000000] (persistent! (assoc! (transient [1 2 3 4 5 6 7 
> >> 8 9 0]) 3 5 6 8))))
> >> Elapsed time: 399.466556 msecs
> >>
> >> Luc P.
> >>
> >>> user=>  (use '[criterium.core])
> >>> nil
> >>> user=> (bench (assoc [1 2 3 4 5 6 7 8 9 0] 3 nil 6 'a)) ;;2 operations
> >>>
> >>> Evaluation count : 125829120 in 60 samples of 2097152 calls.
> >>>                Execution time mean : 488.826554 ns
> >>>       Execution time std-deviation : 19.952095 ns
> >>>      Execution time lower quantile : 459.910320 ns ( 2.5%)
> >>>      Execution time upper quantile : 527.008269 ns (97.5%)
> >>> nil
> >>> user=> (bench (persistent! (assoc! (transient [1 2 3 4 5 6 7 8 9 0]) 3
> >>> nil 6 'a)))
> >>> Evaluation count : 97399860 in 60 samples of 1623331 calls.
> >>>                Execution time mean : 639.789263 ns
> >>>       Execution time std-deviation : 26.265080 ns
> >>>      Execution time lower quantile : 597.753127 ns ( 2.5%)
> >>>      Execution time upper quantile : 687.838668 ns (97.5%)
> >>> nil
> >>> user=> (bench (assoc [1 2 3 4 5 6 7 8 9 0] 3 nil 6 'a 0 "z" 2 5)) ;;4
> >>> operations
> >>> Evaluation count : 68275920 in 60 samples of 1137932 calls.
> >>>                Execution time mean : 901.407416 ns
> >>>       Execution time std-deviation : 35.682637 ns
> >>>      Execution time lower quantile : 851.060950 ns ( 2.5%)
> >>>      Execution time upper quantile : 970.492949 ns (97.5%)
> >>>
> >>> Found 1 outliers in 60 samples (1.6667 %)
> >>>       low-severe     1 (1.6667 %)
> >>>    Variance from outliers : 25.4849 % Variance is moderately inflated by
> >>> outliers
> >>> nil
> >>> user=> (bench (persistent! (assoc! (transient [1 2 3 4 5 6 7 8 9 0]) 3
> >>> nil 6 'a 0 "z" 2 5)))
> >>> Evaluation count : 68844120 in 60 samples of 1147402 calls.
> >>>                Execution time mean : 893.798444 ns
> >>>       Execution time std-deviation : 24.566655 ns
> >>>      Execution time lower quantile : 848.307600 ns ( 2.5%)
> >>>      Execution time upper quantile : 952.841308 ns (97.5%)
> >>>
> >>> Found 13 outliers in 60 samples (21.6667 %)
> >>>       low-severe     7 (11.6667 %)
> >>>       low-mild     6 (10.0000 %)
> >>>    Variance from outliers : 14.2244 % Variance is moderately inflated by
> >>> outliers
> >>> nil
> >>> user=> (bench (assoc [1 2 3 4 5 6 7 8 9 0] 3 nil 6 'a 0 "z" 2 5 4 (atom
> >>> []) 7 "v")) ;;6 operations
> >>> Evaluation count : 39783840 in 60 samples of 663064 calls.
> >>>                Execution time mean : 1.480511 us
> >>>       Execution time std-deviation : 50.249443 ns
> >>>      Execution time lower quantile : 1.425053 us ( 2.5%)
> >>>      Execution time upper quantile : 1.591407 us (97.5%)
> >>> nil
> >>> user=> (bench (persistent! (assoc! (transient [1 2 3 4 5 6 7 8 9 0]) 3
> >>> nil 6 'a 0 "z" 2 5 4 (atom []) 7 "v")))
> >>> Evaluation count : 44755020 in 60 samples of 745917 calls.
> >>>                Execution time mean : 1.358394 us
> >>>       Execution time std-deviation : 49.723547 ns
> >>>      Execution time lower quantile : 1.306456 us ( 2.5%)
> >>>      Execution time upper quantile : 1.473882 us (97.5%)
> >>> nil
> >>>
> >>> user=> (bench (assoc [1 2 3 4 5 6 7 8 9 0] 3 nil 6 'a 0 "z" 2 5 4 (atom
> >>> []) 7 "v" 5 1200 8 -1111)) ;;8 operations
> >>> Evaluation count : 31457280 in 60 samples of 524288 calls.
> >>>                Execution time mean : 1.907389 us
> >>>       Execution time std-deviation : 74.523511 ns
> >>>      Execution time lower quantile : 1.822336 us ( 2.5%)
> >>>      Execution time upper quantile : 2.076044 us (97.5%)
> >>> nil
> >>> user=> (bench (persistent! (assoc! (transient [1 2 3 4 5 6 7 8 9 0]) 3
> >>> nil 6 'a 0 "z" 2 5 4 (atom []) 7 "v" 5 1200 8 -1111)))
> >>> Evaluation count : 37739640 in 60 samples of 628994 calls.
> >>>                Execution time mean : 1.623599 us
> >>>       Execution time std-deviation : 68.677518 ns
> >>>      Execution time lower quantile : 1.529454 us ( 2.5%)
> >>>      Execution time upper quantile : 1.777040 us (97.5%)
> >>>
> >>> Found 1 outliers in 60 samples (1.6667 %)
> >>>       low-severe     1 (1.6667 %)
> >>>    Variance from outliers : 28.6901 % Variance is moderately inflated by
> >>> outliers
> >>> nil
> >>>
> >>>
> >>> etc etc...
> >>>
> >>> you get the idea...conclusion: there is no real benefit to using
> >>> transients for less than 6 operations...
> >>>
> >>> Jim
> >>>
> >>>
> >>>
> >>>
> >>> On 08/11/12 23:04, Philip Potter wrote:
> >>>> Share the benchmark!
> >>>>
> >>>> In theory, conversion to and from transients should be constant time
> >>>> operations, but it would not surprise me if in practice transients
> >>>> aren't universally faster than persistent.
> >>>>
> >>>> Performance in different environments varies wildly, so I would doubt
> >>>> results from a small benchmark on a single machine are universally
> >>>> applicable.
> >>>>
> >>>> Benchmarking is hard, particularly on the jvm. Caching and dynamic
> >>>> inlining and Hotspot confuse matters greatly.
> >>>>
> >>>> Phil
> >>>>
> >>>> On Nov 8, 2012 10:49 PM, "Jim - FooBar();" <jimpil1...@gmail.com
> >>>> <mailto:jimpil1...@gmail.com>> wrote:
> >>>>
> >>>>      Some quick benchmarking that I did, showed that it is actually
> >>>>      more expensive to convert to transient, conj/assoc and convert
> >>>>      back to persistent than the regular conj/assoc unless you want to
> >>>>      do more than 8 operations at a time (preferably more than that).
> >>>>      My experiments were on vectors and the vararg version of 
> >>>> assoc/assoc!.
> >>>>
> >>>>      any thoughts? would you agree?
> >>>>
> >>>>      Jim
> >>>>
> >>>>      --
> >>>>      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
> >>>>      <mailto: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
> >>>>      <mailto:clojure%2bunsubscr...@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 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 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
> >> --
> >> Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!
> >>
> >> -- 
> >> 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
> >>
> > --
> > Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!
> >
> 
> -- 
> 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
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!

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

Reply via email to