Skip to content

Commit f08095c

Browse files
committed
Optimize the classpath implementation
- Avoid repeated conversion between package dotted names ("com.foo") and relative paths ("com/foo/") by threading a `PackageName` instance through the aggregate classpath lookup which caches the path name. - Avoid creating result buffers inside of each element of the aggregate classpath by introducing a callback based API that lets `AggregateClasspath` use a single buffer.
1 parent f41ff0e commit f08095c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/scala/collection/mutable/AnyRefMap.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ extends AbstractMap[K, V]
108108
var e = h & mask
109109
var x = 0
110110
var g = 0
111-
while ({ g = _hashes(e); g != 0}) {
112-
if (g == h && { val q = _keys(e); (q eq k) || ((q ne null) && (q equals k)) }) return e
111+
val hashes = _hashes
112+
val keys = _keys
113+
while ({ g = hashes(e); g != 0}) {
114+
if (g == h && { val q = keys(e); (q eq k) || ((q ne null) && (q equals k)) }) return e
113115
x += 1
114116
e = (e + 2*(x+1)*x - 3) & mask
115117
}

0 commit comments

Comments
 (0)