We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kim Hansen reported on #scala that +: is two magnitudes slower than enqueue:
object QueuePerformance { println("Test performance of Queue") //> Test performance of Queue import scala.collection.immutable.Queue def time[A](f: => A) = { f for (_ <- 1 to 3) { val s = System.nanoTime f println("time: " + (System.nanoTime - s) / 1e6 + "ms") } } //> time: [A](f: => A)Unit val count = 10000 //> count : Int = 10000 time { var q = Queue.empty[Int] for (i <- 1 to count) { q = q enqueue i } println(q.dequeue._1) } //> 1 //| 1 //| time: 19.326757ms //| 1 //| time: 3.575115ms //| 1 //| time: 1.428872ms time { var q = Queue.empty[Int] for (i <- 1 to count) { q = q :+ i } println(q.dequeue._1) } //> 1 //| 1 //| time: 576.121048ms //| 1 //| time: 511.96562ms //| 1 //| time: 582.245494ms }
The same thing should probably happen for +:.
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-8059?orig=1 Reporter: @soc Affected Versions: 2.10.3, 2.11.0-M7
Sorry, something went wrong.
@adriaanm said: scala/scala#3250
soc
No branches or pull requests
Kim Hansen reported on #scala that +: is two magnitudes slower than enqueue:
The same thing should probably happen for +:.
The text was updated successfully, but these errors were encountered: