For the case where the string wasn't necessary, it's still very unlikely we
need the tree traversal (which the fast contains check avoids). The
traversal is much more expensive than creating a string, and will likely
only be hit in an error case.

On Thursday, February 20, 2014, Grzegorz Kossakowski <
notifications@github.com> wrote:

> In src/compiler/scala/tools/nsc/ast/parser/Parsers.scala:
>
> > @@ -1153,10 +1153,15 @@ self =>
> >
> >        val pkg = qualId()
> >        newLineOptWhenFollowedBy(LBRACE)
> > +      val pkgString = pkg.toString
>
> Doesn't this introduce performance bottleneck by creating strings
> needlessly? We would call pkg.toString for top level packages only.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/scala/scala/pull/3565/files#r9922150>
> .
>