Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Improve" root import filter for universal members #8547

Merged
merged 1 commit into from Nov 21, 2019

Conversation

som-snytt
Copy link
Contributor

Instead of elaborate import selector machinery,
just filter at ImportInfo.

Follow-up to #8541 with JZ's clever suggestion.

He really doesn't like it when you mess up his benchmarks.

Instead of elaborate import selector machinery,
just filter at ImportInfo.
@scala-jenkins scala-jenkins added this to the 2.13.2 milestone Nov 20, 2019

@tailrec
private def transformImport(selectors: List[ImportSelector], sym: Symbol): List[Symbol] = selectors match {
case Nil => Nil
case sel :: Nil if sel.isWildcard => List(sym)
case sel :: Nil if sel.isWildcard =>
if (isRootImport && definitions.isUnimportableUnlessRenamed(sym)) Nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. isUniversalMember, but using this method for uniformity with the main case above. allImportedSymbols is used for completions.

@som-snytt
Copy link
Contributor Author

As we say in testing, "I must be doing something wrong."

I ran some tests during lunch.

I expected to see a number, then a number that got bigger, and then another number that got smaller.

Yes, I read the part where: "Do not assume the numbers tell you what you want them to tell."

@som-snytt som-snytt changed the title Improve root import filter for universal members "Improve" root import filter for universal members Nov 20, 2019
@retronym
Copy link
Member

I am seeing a speedup:

[info] HotScalacBenchmark.compile                     ../corpus          a8c43dc                    false  2.13.2-bin-f80f5b8-SNAPSHOT    scalap  sample  330   981.146 ± 1.920  ms/op                           z
[info] HotScalacBenchmark.compile                     ../corpus           latest                    false  2.13.2-bin-3d0d203-SNAPSHOT    scalap  sample  330   962.412 ± 3.381  ms/op

Your numbers look suspiciously slow (in the base line and in the patched version). Maybe there is another factor dominating the the performance? What hardware + OS did you use?

@retronym retronym added the performance the need for speed. usually compiler performance, sometimes runtime performance. label Nov 21, 2019
@retronym retronym merged commit 3481201 into scala:2.13.x Nov 21, 2019
@som-snytt
Copy link
Contributor Author

I'll get more experience with it and also not do any gaming while running tests (kidding).

Thanks again for the code hint.

@som-snytt som-snytt deleted the issue/5389-improved branch November 21, 2019 04:01
@som-snytt
Copy link
Contributor Author

Running benchmark on home Dell i7 with SSD, Ubuntu subsystem under windows, instead of office Dell xeon Ubuntu with fidget spinner disks yields smaller numbers. Smaller is better, right?

@retronym
Copy link
Member

Yep, smaller is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance the need for speed. usually compiler performance, sometimes runtime performance.
Projects
None yet
3 participants