diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-19 11:19:41 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-21 18:42:50 +0100 |
commit | 889bca2de4678194ef28e24dc3513e94b5363616 (patch) | |
tree | 642c884c26e872990b4473507ec08e2d4eef4052 /src | |
parent | 2633300305df2cc40142d287cb715c3bd8561fc8 (diff) | |
download | dotty-889bca2de4678194ef28e24dc3513e94b5363616.tar.gz dotty-889bca2de4678194ef28e24dc3513e94b5363616.tar.bz2 dotty-889bca2de4678194ef28e24dc3513e94b5363616.zip |
Performance improvement: Replace == with equals in util.HashTable
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/util/HashSet.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/util/HashSet.scala b/src/dotty/tools/dotc/util/HashSet.scala index 32c3dbc3d..44646e2ba 100644 --- a/src/dotty/tools/dotc/util/HashSet.scala +++ b/src/dotty/tools/dotc/util/HashSet.scala @@ -30,7 +30,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte var h = index(hash(x)) var entry = table(h) while (entry ne null) { - if (x == entry) + if (x equals entry) return entry.asInstanceOf[T] h = index(h + 1) @@ -49,7 +49,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte def findEntry(x: T): T = { var h = index(hash(x)) var entry = table(h) - while ((entry ne null) && x != entry) { + while ((entry ne null) && !(x equals entry)) { h = index(h + 1) entry = table(h) } @@ -79,7 +79,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte var h = index(hash(x)) var entry = table(h) while (entry ne null) { - if (x == entry) return + if (x equals entry) return h = index(h + 1) entry = table(h) } |