Skip to content

Try to refine handling of SymDenotations V2 #4512

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

Closed
wants to merge 12 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 11, 2018

It seems we get many cache misses when going from Symbols to their denotations. This is a very common operation: When compiling typer/*.scala, we generate ~80K symbols, ~125K SymDenotations, yet dereference .denot more than 15.8M times. Of these, 11.7M go to the symbol's initial denotation.

After closing #4504, this PR tries something else: Cache the hottests fields of denotations
in symbols, so that we can get at them without a dereference.

We don't need to introduce forwarders in Symbols to do this (although it might be a good idea for other reasons), and we don't need to have Symbol inherit from SymDenotation (which has proven to be a bad idea).

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Commit Messages

We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).

Please stick to these guidelines for commit messages:

  1. Separate subject from body with a blank line
  2. When fixing an issue, start your commit message with Fix #<ISSUE-NBR>:
  3. Limit the subject line to 72 characters
  4. Capitalize the subject line
  5. Do not end the subject line with a period
  6. Use the imperative mood in the subject line ("Add" instead of "Added")
  7. Wrap the body at 80 characters
  8. Use the body to explain what and why vs. how

adapted from https://chris.beams.io/posts/git-commit

Have an awesome day! ☀️

@odersky
Copy link
Contributor Author

odersky commented May 11, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 3 job(s) in queue, 1 running.

@odersky
Copy link
Contributor Author

odersky commented May 11, 2018

Current status: Symbol.denot calls reduced from 15.8M to 6.4M when compiling typers/*.scala

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/4512/ to see the changes.

Benchmarks is based on merging with master (97f4155)

@odersky
Copy link
Contributor Author

odersky commented May 11, 2018

test performance please

@odersky
Copy link
Contributor Author

odersky commented May 11, 2018

The previous performance test have a 404. What could be the reason for this?

@dottybot
Copy link
Member

performance test scheduled: 4 job(s) in queue, 1 running.

@smarter
Copy link
Member

smarter commented May 11, 2018

The previous performance test have a 404. What could be the reason for this?

This happens randomly sometimes, I don't know if @liufengyun knows the root cause, but the workaround is to add index.html at the end: http://dotty-bench.epfl.ch/4512/index.html

@odersky
Copy link
Contributor Author

odersky commented May 11, 2018

@smarter Thanks for the tip!

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/4512/ to see the changes.

Benchmarks is based on merging with master (2136fc1)

@odersky
Copy link
Contributor Author

odersky commented May 12, 2018

Rebased to master

@odersky
Copy link
Contributor Author

odersky commented May 12, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/4512/ to see the changes.

Benchmarks is based on merging with master (83735d2)

@odersky
Copy link
Contributor Author

odersky commented May 12, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/4512/ to see the changes.

Benchmarks is based on merging with master (c38a6b7)

@odersky odersky removed the stat:wip label May 28, 2018
@odersky
Copy link
Contributor Author

odersky commented May 28, 2018

test performance please

@dottybot
Copy link
Member

dottybot commented Jun 2, 2018

performance test scheduled: 1 job(s) in queue, 1 running.

@dottybot
Copy link
Member

dottybot commented Jun 2, 2018

performance test failed:

Please check http://lamppc37.epfl.ch:8000/pull-4512-06-02-18.37.out for more information

@allanrenucci
Copy link
Contributor

allanrenucci commented Jun 2, 2018

There is probably some merge breakage

odersky added 6 commits June 7, 2018 17:47
This preserves the former behavior on NoDenotation.
... rather than the global ctx.uniqueNamedRefs hashtable. This reduces the size of
the hashtable by a bit more than half
Reverted from commit 7587f9c
This one seemed to cause a performance regression.
@odersky
Copy link
Contributor Author

odersky commented Jun 8, 2018

test performance please

@dottybot
Copy link
Member

dottybot commented Jun 8, 2018

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

dottybot commented Jun 8, 2018

performance test failed:

Please check http://lamppc37.epfl.ch:8000/pull-4512-06-08-09.19.out for more information

@liufengyun
Copy link
Contributor

The performance failure is fixed, the result is here: http://dotty-bench.epfl.ch/4512

@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from dottybot Jun 8, 2018
@scala scala deleted a comment from odersky Jun 8, 2018
@odersky
Copy link
Contributor Author

odersky commented Jun 12, 2018

So it seems there's a significant speedup for dotty itself (about 3% according to latest benchmark), and no speedups for the other tests. I'll run one more test, and then we can decide what to do with this.

@odersky
Copy link
Contributor Author

odersky commented Jun 12, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@allanrenucci
Copy link
Contributor

allanrenucci commented Jun 12, 2018

I see a non negligible slow down for scalap and re2.

Isn't the speedup on Dotty artificial? My guess is that the speedup comes from the changes in the Dotty code base and not from a faster compiler . By adding all the cached SymDenotation facades to Symbol, you significantly reduce the number of implicit conversions from Symbol to SymDenotation.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/4512/ to see the changes.

Benchmarks is based on merging with master (df3c9b5)

@allanrenucci allanrenucci self-assigned this Jun 26, 2018
@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2018

No clear win, except for dotty. Let's cherry-pick any improvements that make sense.

@odersky odersky closed this Jun 26, 2018
nicolasstucki added a commit that referenced this pull request Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants