diff options
author | Paul Phillips <paulp@improving.org> | 2011-03-29 03:25:38 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-03-29 03:25:38 +0000 |
commit | 92693774c1567009223a086786978c76d594fdb9 (patch) | |
tree | ac16410b1f7933727e94935c574c9876fec4b3db /test/disabled | |
parent | 5ebbba7a711105d8b6b19ce6497b3dcef0039c6f (diff) | |
download | scala-92693774c1567009223a086786978c76d594fdb9.tar.gz scala-92693774c1567009223a086786978c76d594fdb9.tar.bz2 scala-92693774c1567009223a086786978c76d594fdb9.zip |
And so my attempt to have a performance test dr...
And so my attempt to have a performance test draws the final curtain, no
review.
Diffstat (limited to 'test/disabled')
-rw-r--r-- | test/disabled/run/bug4279.scala | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/disabled/run/bug4279.scala b/test/disabled/run/bug4279.scala new file mode 100644 index 0000000000..d0afc3a032 --- /dev/null +++ b/test/disabled/run/bug4279.scala @@ -0,0 +1,38 @@ +import scala.tools.partest._ + +// Attempting to verify slice isn't 100,000x slower +// with views than non-views. +class Runner(num: Int, reps: Int) extends TestUtil { + var dummy = 0 + val range = Array.range(0, num) + + def iteratorSlice = { + def it = range.iterator.slice(num - 2, num) + for (i <- 1 to reps) + it foreach (dummy = _) + } + def viewSlice = { + val view = range.view.slice(num - 2, num) + for (i <- 1 to reps) + view foreach (dummy = _) + } + def straightSlice = { + val xs = range.slice(num - 2, num) + for (i <- 1 to reps) + xs foreach (dummy = _) + } + def run(multiple: Double) = { + verifySpeed(straightSlice, iteratorSlice, multiple) + verifySpeed(straightSlice, viewSlice, multiple) + } +} + +object Test { + def main(args: Array[String]): Unit = { + // warmup + { val r = new Runner(1000000, 10) ; r.straightSlice ; r.iteratorSlice ; r.viewSlice } + + new Runner(10000000, 10) run 500 + new Runner(10000000, 50) run 300 + } +} |