diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-18 00:59:00 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-18 02:19:12 -0700 |
commit | 0e061f420f3b6e7447658f003d00f6108fa649e0 (patch) | |
tree | 0b8593545df932f08b051441112ce2ae2f6804e3 /src/library/scala/collection/immutable/Vector.scala | |
parent | 66603a2c003852d39faec20a9763fb0e25049cf4 (diff) | |
download | scala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.gz scala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.bz2 scala-0e061f420f3b6e7447658f003d00f6108fa649e0.zip |
Removed many @inline annotations and final modifiers.
It is my belief that these @inlines and finals landed between
unhelpful and harmful. I am sure this will be disputed in some
cases. It's too much and too difficult to measure except in the
aggregate unless we have specific @inline sites to discuss.
I don't know upon whom the burden of proof lies. I think we
should err on the side given here, since there is no evidence
of any consistent rationale being applied and it is easy to
verify the negative impact scala compiler inlining can have on
hotspot's far more sophisticated inlining.
Diffstat (limited to 'src/library/scala/collection/immutable/Vector.scala')
-rw-r--r-- | src/library/scala/collection/immutable/Vector.scala | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala index 98b5aa6d9f..a33bf2c9c5 100644 --- a/src/library/scala/collection/immutable/Vector.scala +++ b/src/library/scala/collection/immutable/Vector.scala @@ -25,11 +25,11 @@ object Vector extends SeqFactory[Vector] { private val VectorReusableCBF: GenericCanBuildFrom[Nothing] = new VectorReusableCBF - @inline implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] = + implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] = VectorReusableCBF.asInstanceOf[CanBuildFrom[Coll, A, Vector[A]]] def newBuilder[A]: Builder[A, Vector[A]] = new VectorBuilder[A] private[immutable] val NIL = new Vector[Nothing](0, 0, 0) - @inline override def empty[A]: Vector[A] = NIL + override def empty[A]: Vector[A] = NIL } // in principle, most members should be private. however, access privileges must @@ -94,7 +94,7 @@ override def companion: GenericCompanion[Vector] = Vector if (s.depth > 1) s.gotoPos(startIndex, startIndex ^ focus) } - @inline override def iterator: VectorIterator[A] = { + override def iterator: VectorIterator[A] = { val s = new VectorIterator[A](startIndex, endIndex) initIterator(s) s @@ -120,16 +120,6 @@ override def companion: GenericCompanion[Vector] = Vector // In principle, escape analysis could even remove the iterator/builder allocations and do it // with local variables exclusively. But we're not quite there yet ... - @deprecated("this method is experimental and will be removed in a future release", "2.8.0") - @inline def foreachFast[U](f: A => U): Unit = iterator.foreachFast(f) - @deprecated("this method is experimental and will be removed in a future release", "2.8.0") - @inline def mapFast[B, That](f: A => B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = { - val b = bf(repr) - foreachFast(x => b += f(x)) - b.result - } - - def apply(index: Int): A = { val idx = checkRangeConvert(index) //println("get elem: "+index + "/"+idx + "(focus:" +focus+" xor:"+(idx^focus)+" depth:"+depth+")") @@ -147,17 +137,17 @@ override def companion: GenericCompanion[Vector] = Vector // SeqLike api - @inline override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { + override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { case _: Vector.VectorReusableCBF => updateAt(index, elem).asInstanceOf[That] // just ignore bf case _ => super.updated(index, elem)(bf) } - @inline override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { + override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { case _: Vector.VectorReusableCBF => appendFront(elem).asInstanceOf[That] // just ignore bf case _ => super.+:(elem)(bf) } - @inline override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { + override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match { case _: Vector.VectorReusableCBF => appendBack(elem).asInstanceOf[That] // just ignore bf case _ => super.:+(elem)(bf) } @@ -696,9 +686,6 @@ extends AbstractIterator[A] v.initFrom(this) v } - - @deprecated("this method is experimental and will be removed in a future release", "2.8.0") - @inline def foreachFast[U](f: A => U) { while (hasNext) f(next()) } } |