How do you estimate the potential gain of the rare case of a software rewrite that makes sense? You want to differentiate between the two outcomes: - "this is one the best pieces of work I've ever done" - "we tried our best; I wished we knew better from the start"
-
Show this thread
-
I went through that exercise when software == compiler. A thread! Let me start off with admitting I'm cheating by narrowing down the gain to performance. Now that we got this out of the way, the answer is reasoning from first principles.
1 reply 0 retweets 0 likesShow this thread -
The question is: what's the gap between compiler's performance and the inherent complexity of the problem (e.g. language features) normalized by how quickly computers can compute?
1 reply 0 retweets 0 likesShow this thread -
The gap is the estimate of the bloat and excess, use of inefficient algorithms and datastructures in the implementation. I wondered about this for Scala compiler when I was trying to understand whether Scala has a design flaw. So I ran an experiment.
1 reply 0 retweets 0 likesShow this thread -
I generated Java and Scala code side-by-side whose compilation by either javac and scalac (and dottyc) requires the same amount of work. The result ispic.twitter.com/aQWFXOib7k
1 reply 3 retweets 5 likesShow this thread -
I gasped when I saw this chart for the first time. Dotc is a rewrite of Scala from scratch and it landed exactly at the same performance. For a rewrite of such scale, it's hard to believe no extraterrestrial forces were involved in shaping that chart.
1 reply 1 retweet 4 likesShow this thread -
I'm digressing, though. The gap is angular in this chart: you want to compare the relative slopes of the curves for javac and scalac. The comparison shows that scalac/dotc is 6x slower than javac for solving the task of the same complexity.
1 reply 0 retweets 2 likesShow this thread -
The lower limit of improving scalac/dotc performance is 6x for this task. I don't know if javac solves the compilation task optimally so this experiment sets just the lower limit.
2 replies 0 retweets 0 likesShow this thread -
Replying to @gkossakowski
I think the comparison is a bit misleading, though... even if the input provided to Scala is the same complexity as Java, the fact that Scala *can* accept more complex input put a dynamic requirement (ie more work) on Scalac which Javac doesn't have.
2 replies 0 retweets 0 likes -
Replying to @propensive @gkossakowski
As an extreme example, consider a trivial compiler which only accepts one single possible Java program as input. It could "compile" it near-instantaneously, and Javac would never be able to match it.
1 reply 0 retweets 0 likes
But I really like the experimentation you're doing. It does at least feel like there is a lot of scope to improve compiler performance in scalac/dotc!
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.