Skip to content

Laser focus on outlining#85

Merged
xeno-by merged 1 commit intotwitter:masterfrom
xeno-by:topic/focus
Jul 7, 2018
Merged

Laser focus on outlining#85
xeno-by merged 1 commit intotwitter:masterfrom
xeno-by:topic/focus

Conversation

@xeno-by
Copy link
Contributor

@xeno-by xeno-by commented Jul 7, 2018

Recently, Stu Hood came up with a groundbreaking idea. He suggested that Rsc can become useful much earlier that we initially thought. Stu's key insight was to serialize the results of outlining into
a format understood by the Scala compiler and then use that to launch multiple independent instances of the Scala compiler to parallelize Scala compilation.

Towards that end, we postponed the initial plan to implement a Scala typechecker in Rsc and decided to focus on outlining for the time being. We came up with the following design of a compilation pipeline for Rsc:

So far, we have implemented support for a subset of Scala to produce signatures for automatically rewritten core of Twitter Util. We will be working on adding support for more Scala features according to our roadmap.

(We have also just learned about an independent effort based on a similar architecture by Guillaume Martres: scala/scala3#4767).

Recently, Stu Hood came up with a groundbreaking idea. He suggested
that Rsc can become useful much earlier that we initially thought.
Stu's key insight was to serialize the results of outlining into
a format understood by the Scala compiler and then use that to launch
multiple independent instances of the Scala compiler to parallelize
Scala compilation.

Towards that end, we postponed the initial plan to implement a Scala
typechecker in Rsc and decided to focus on outlining for the time being.
We came up with the following design of a compilation pipeline for Rsc:
  * Metacp converts dependency classpath into the SemanticDB format,
    i.e. the metadata format of the Scalameta toolchain that is used
    internally at Twitter for Scalafix and Language Server Protocol.
  * Rsc computes signatures of all public and protected definitions
    in Scala sources.
  * Rsc saves signatures to disk in SemanticDB format.
  * Mjar converts signatures into the ScalaSignature format,
    i.e. the metadata format of the Scala compiler.

So far, we have implemented support for a subset of Scala to produce
signatures for automatically rewritten core of Twitter Util.
We will be working on adding support for more Scala features according
to our roadmap.

(We have also just learned about an independent effort within the Dotty
project based on a similar architecture by Guillaume Martres.)
@rorygraves
Copy link
Contributor

Woot! This sounds awesome

@smarter
Copy link

smarter commented Jul 7, 2018

This is really interesting, but I'm surprised to see this appearing as a giant code dump, any reason that this was not developed in the open? Can we expect more code dumps like this in the future? It'd be nice to at least preserve the git history instead of squashing everything in one commit, there's usually a lot of knowledge in commit messages!

@xeno-by
Copy link
Contributor Author

xeno-by commented Jul 7, 2018

@smarter The fate of this new design was decided by the numbers. If SemanticDB generation for signatures of a real-world project ended up being not ~28x faster, but say only ~1.5x faster, we would be back to the drawing board. Therefore, in this case, we felt that upfront experimental evaluation was a prerequisite for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants