The Lost Feed

🔬Weird Science

The Strange Story of Lichess and Scala 3

Lichess, the popular free chess site, faced a big challenge moving to Scala 3. Discover the story and why they asked for help.

3 views·5 min read·Jun 21, 2026
Lichess on Scala3 – Help needed

Imagine a massive online game, played by millions. Now imagine the code that runs it is like a complex engine. What happens when you need to upgrade that engine to a brand new, powerful version? That's the situation Lichess, the beloved free chess platform, found itself in.

They decided to take their main programming language, Scala, from version 2 to the much newer Scala

  1. This wasn't just a small tweak. It was a huge leap, promising better performance and new features. But as they started the jump, they ran into some serious speed bumps.

A Giant Leap for Chess Code

Lichess is more than just a website. It's a huge system that needs to be super fast and reliable. Every move, every game, every connection needs to work perfectly. The code behind it is written in Scala, a language known for being powerful but also tricky to master.

Scala 3 was released with a lot of excitement. It offered new ways to write code that could be cleaner and more efficient. For a project as big as Lichess, adopting Scala 3 seemed like a smart move to keep the platform running at its best for years to come. The team behind Lichess is known for being forward-thinking and always looking for ways to improve.

The Unexpected Slowdown

As the Lichess developers began the process of switching their main codebase over to Scala 3, they discovered something alarming. The new version, which was supposed to be faster, was actually making their code run much slower. This was the opposite of what they expected and a major problem for a site that depends on speed.

Compiling the code, which is the process of turning human-readable instructions into computer instructions, took a lot longer. Not just a little longer, but significantly longer. In some cases, it was taking hours instead of minutes. This delay impacted their ability to develop new features and fix bugs quickly.

Why the Big Difference?

So, why was Scala 3 causing this slowdown? The developers suspected it had something to do with how the new version handled certain complex coding structures. Scala allows for very advanced ways of writing code, and Scala 3 introduced new rules and systems for these advanced features.

It turned out that some of the ways Lichess had been using Scala 2, while effective, were not translating well to the new Scala 3 system. The compiler, the program that checks and builds the code, was struggling. It was working much harder to understand and process these specific parts of the Lichess code, leading to the dramatic increase in compilation time.

A Call for Help

Across the Internet

Facing this major hurdle, the Lichess team realized they couldn't solve it alone. The problem was so specific and complex that they needed help from the wider Scala community. This is when they decided to share their situation publicly, hoping that other experts might have insights or solutions.

They posted a detailed explanation of the problem, including code examples and performance data. It was a brave move, showing that even a highly skilled team can encounter issues that require outside knowledge. They were essentially asking, "We've hit a wall with Scala 3 performance on our massive project. Can anyone help us figure this out?"

What Was So Tricky?

One of the main areas causing trouble was related to Scala's advanced features, like *implicits

  • and macros. These are powerful tools that let programmers write code very cleverly, but they can also be difficult for the compiler to process efficiently, especially in a huge project like Lichess.

"We're seeing compilation times that are much, much longer than before. It's impacting our development speed significantly."

The Lichess team provided specific examples of code patterns that were causing the most pain. These were areas where Scala 3's new compiler was working overtime, trying to figure out complex relationships between different parts of the code. It was like asking a super-smart assistant to solve an incredibly complicated puzzle, and they were taking a very long time to find the answer.

The Community Responds

As expected, the Scala community is full of passionate and knowledgeable people. When Lichess put out their call for help, many developers and language experts paid attention. They understood the importance of Lichess and the challenge of migrating such a large system.

Discussions began online, with people offering theories, suggestions, and even trying to replicate the performance issues on their own systems. Some people suggested alternative ways to structure the problematic code. Others looked for specific bugs within the Scala 3 compiler itself that might be causing the slowdown.

Lessons Learned from the Lichess Challenge

The story of Lichess and Scala 3 highlights a few important points about software development. Firstly, even the most popular and well-built software can run into unexpected problems when adopting new technologies. Upgrading major systems is rarely simple.

Secondly, it shows the power of open-source communities. Lichess is a free and open platform, and its success relies on the support of many. When they faced a problem, the community was willing to step in and offer their expertise. This collaborative spirit is crucial for pushing technology forward.

Finally, it's a reminder that performance can be tricky. What seems like a small change in code can sometimes have a big impact on how fast a program runs. Optimizing code for speed is an ongoing battle, especially for systems that handle millions of users.

The Lichess team's willingness to be open about their struggles and ask for help is a valuable lesson for all developers. It shows that it's okay to not have all the answers and that working together often leads to the best solutions. The future of Lichess, and its use of Scala 3, will be interesting to watch as they continue to work through these performance challenges with the help of the global coding community.

How does this make you feel?

Comments

0/2000

Loading comments...