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

Split Context into Period/Mode and everything else #9372

Closed
wants to merge 1 commit into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 16, 2020

Based on #9343. #9343 is a refactoring that improves architectural consistency. By contrast this PR is only for performance. If performance does not noticeably improve once it's done, it's not worth keeping it.

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 odersky marked this pull request as draft July 16, 2020 07:52
@odersky odersky force-pushed the add-cstate branch 4 times, most recently from 24574b8 to 10255b0 Compare July 17, 2020 11:05
@odersky
Copy link
Contributor Author

odersky commented Jul 19, 2020

test performance please

@dottybot
Copy link
Member

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

@dottybot
Copy link
Member

performance test failed:

Please check http://lamppc37.epfl.ch:8000/pull-9372-07-19-13.50.out for more information

@odersky
Copy link
Contributor Author

odersky commented Jul 19, 2020

test performance please

@dottybot
Copy link
Member

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

@dottybot
Copy link
Member

Performance test finished successfully:

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

Benchmarks is based on merging with master (21a90aa)

@odersky
Copy link
Contributor Author

odersky commented Jul 20, 2020

In tried to run performance tests locally on just compiling typer/*.scala. Once all optimizations are in, I got maybe a 1% improvement. Hard to say with the noise. This could mean two things:

  1. The handling of periods does not matter in the large picture. Which seems surprising, since they are everywhere.
  2. The good (having periods as local variables instead of object fields, creating fewer contexts) cancels out the bad (having to pass two parameters instead of one virtually everywhere).

To test these hypotheses, c640a35 contains only the bad and not the good. I.e. we pass periods as a separate parameter but then use the context field anyway. It looks like this gives a 4 to 5 % slowdown.

In any case, it seems the cost is too high to justify the gains. So I am closing this PR and will use some ideas coming out of this experiment later.

@odersky odersky closed this Jul 20, 2020
@odersky odersky reopened this Jul 20, 2020
@odersky
Copy link
Contributor Author

odersky commented Jul 20, 2020

I noticed the last PR was slightly than just keeping the bad. Testing again with a more precise setup.

@odersky
Copy link
Contributor Author

odersky commented Jul 20, 2020

test performance please

@dottybot
Copy link
Member

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

@dottybot
Copy link
Member

Performance test finished successfully:

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

Benchmarks is based on merging with master (b7b03b3)

Also:

 - Change functions from Context to context functions. In particular:

     - `newSymbol`, `requiredSymbol` etc, now are available
       from Symbols, no `ctx.` prefix needed
     - All reporing methods are available from `report` object.
 - Add atPhase, atPhaseNoLater, addPhaseNoEarlier and have them replace
   most uss of `withPhase`...
 - Add inMode, withMode, withoutMode utility wrappers
 - Move error messages directly into reporting: this avoids
   an annoying import
 - Convert old style implicit parameters to `(using Context)`
 - Reorganize TyperState.test: Instead of overwriting fields of TyperState, keep test
   contexts in an explicit stack, so that they can be re-used. This is simpler and
   since there is more decoupling between tests. Usage is now
   `Contexts.explore(...)` instead of `ctx.test(...)`.
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.

2 participants