diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-05-21 10:40:13 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-05-26 17:31:26 +0200 |
commit | 4aa10a1f6fa803159638355ef9c2aa968eb16556 (patch) | |
tree | 9b75da5c4a6194f3324313099fe31e94045c2ead /bincompat-forward.whitelist.conf | |
parent | a6714f8fee2f8df9bc9d4760ed4c0c799f4f2c11 (diff) | |
download | scala-4aa10a1f6fa803159638355ef9c2aa968eb16556.tar.gz scala-4aa10a1f6fa803159638355ef9c2aa968eb16556.tar.bz2 scala-4aa10a1f6fa803159638355ef9c2aa968eb16556.zip |
Optimize nested scope creation
We can copy the hash table from the parent scope, rather
than constructing it from scratch.
This takes us to:
% rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala;
real 0m19.639s // head~1 was 0m35.662s
user 0m41.683s // head~1 was 0m58.275s
sys 0m1.886s
In more detail, this commit:
- Removes the unused `fingerprint` constructor parameter from
scopes. This is a remnant from a previous optimization attempt
- Leave only one constructor on Scope which creates an empty
scope
- Update the factory method, `newNestedScope`, to copy the hash
table from the parent if it exists. We can rely on the invariant
that `outer.hashTable != null || outer.size < MIN_HASH)`, so we
don't need `if (size >= MIN_HASH) createHash()` anymore. This
used to be needed in `Scope#<init>`, which accepted an aribitrary
`initElems: ScopeEntry`.
- Update subclasses and factories of `Scope` in runtime reflection
to accomodate the change. Pleasingly, we could actually remove
the override for `newNestedScope`.
- Unit tests the functionality I'm touching
Diffstat (limited to 'bincompat-forward.whitelist.conf')
-rw-r--r-- | bincompat-forward.whitelist.conf | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf index ca8f7468eb..3cd985aeae 100644 --- a/bincompat-forward.whitelist.conf +++ b/bincompat-forward.whitelist.conf @@ -230,6 +230,10 @@ filter { { matchName="scala.reflect.runtime.JavaMirrors#JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$followStatic" problemName=MissingMethodProblem + }, + { + matchName="scala.reflect.runtime.SynchronizedOps.newNestedScope" + problemName=MissingMethodProblem } ] } |