diff options
author | Paul Phillips <paulp@improving.org> | 2011-09-19 04:48:39 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-09-19 04:48:39 +0000 |
commit | 2553cc1fdc5658357643431ed7af20dca637529a (patch) | |
tree | b4db1d3df3cd35bcf5bdc4edb747c8f52ab1655a /src/library | |
parent | 0c25af0ec8e19b4e6e40a6c4a806659004f506d0 (diff) | |
download | scala-2553cc1fdc5658357643431ed7af20dca637529a.tar.gz scala-2553cc1fdc5658357643431ed7af20dca637529a.tar.bz2 scala-2553cc1fdc5658357643431ed7af20dca637529a.zip |
ListBuffer.size should be O(1).
Not O(n) like it was. Here's another good candidate for some mythical
performance regression tests. Closes SI-4933, no review.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/mutable/ListBuffer.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala index aec7b7bce9..b55cad8fbb 100644 --- a/src/library/scala/collection/mutable/ListBuffer.scala +++ b/src/library/scala/collection/mutable/ListBuffer.scala @@ -64,6 +64,9 @@ final class ListBuffer[A] */ override def length = len + // Don't use the inherited size, which forwards to a List and is O(n). + override def size = length + // Implementations of abstract methods in Buffer override def apply(n: Int): A = |