It is said often that the compilation speed is slow about Scala. So I began to try improve compilation speed of scalac in my repository. I did to improve the compilation speed in my repository:
- Replace many straightforward pattern matchings with pattern matchings compiled to tableswitch using @switch.
- Cache hashCode
- Replace many for-expressions with while expressions to avoid function object allocations.
- , etc.
However, it doesn’t improve very much. Where is the bottleneck of scalac? I know typer phase takes much time. But I don’t know the detail.