MeWe had proactively prepared their system for a potential migration to Scala 3. Once they decided to proceed, they initiated the code conversion in-house and migrated most dependencies to Scala 3.
However, they soon experienced significant slowdowns in compilation times, which extended developers’ working hours, impacting the entire system through a chain reaction.
Spanning over 200,000 lines of code, the issues were difficult to detect. Following our client’s migration, MeWe engaged VirtusLab, the developers behind the Scala 3 compiler, to assist with the issue.
Initially faced with vague analysis tools and overly complex tracing outputs, VirtusLab reintroduced the -Yprofile-trace flag, a proven feature from Scala 2. This strategic move significantly enhanced the compiler's ability to generate visual and analyzable performance data, leading to valuable insights. They quickly identified major bottlenecks.
- Inferring types for a long sequence of Tapir endpoints—a complex generic data type essential for HTTP servers.
- Inferring a type at each compilation stage or when defining parts of the endpoint, particularly when intersection types were involved in input or output type parameters.
Collaborating with the EPFL compiler team, VirtusLab conducted extensive tests across the Scala 3 ecosystem to avoid any risk of causing regressions that could impact the entire codebase or projects from our Open Community Build.
The new Scala 3 compiler version eliminated the issue in our client's projects and in 1600 projects tested within our Open Community Build.
- The compile times were reduced by 77% from fifteen minutes to three and a half minutes.
- The whole Scala community benefits from an improved Scala 3 compiler performance.
- VirtusLab extended the compiler with detailed profiling capabilities, useful when optimizing large code bases.