Created
October 31, 2013 20:55
-
-
Save ryanlecompte/7257010 to your computer and use it in GitHub Desktop.
::: generally better for List[A]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ scala-2.10.1 bin/scala -cp "/Users/ryan/dev/research/thyme/Thyme.jar" | |
Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_45). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> val th = new ichi.bench.Thyme | |
th: ichi.bench.Thyme = ichi.bench.Thyme@786f9982 | |
scala> val l1 = List.range(1,1000) | |
scala> val l2 = List.range(1,1000) | |
scala> th.pbench { l1 ++ l2 } | |
Benchmark (81900 calls in 2.200 s) | |
Time: 25.13 us 95% CI 24.08 us - 26.18 us (n=20) | |
Garbage: 293.0 ns (n=14 sweeps measured) | |
scala> th.pbench { l1 ::: l2 } | |
Benchmark (81900 calls in 2.150 s) | |
Time: 25.25 us 95% CI 24.15 us - 26.35 us (n=20) | |
Garbage: 244.1 ns (n=11 sweeps measured) | |
scala> th.pbench { l1 ::: Nil } | |
Benchmark (671088620 calls in 2.529 s) | |
Time: 3.755 ns 95% CI 3.624 ns - 3.886 ns (n=20) | |
scala> th.pbench { l1 ++ Nil } | |
Benchmark (83886060 calls in 1.593 s) | |
Time: 17.71 ns 95% CI 16.68 ns - 18.75 ns (n=20) | |
Garbage: 0.3338 ns (n=16 sweeps measured) | |
scala> 671088620 > 83886060 | |
res4: Boolean = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment