<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn" -->

---
title: Porting the Scala 2 optimizer to Scala 3 | daily.dev
description: The Scala 2 compiler's optimizer, which inlines and simplifies high-level code like map calls into fast low-level loops, is being ported to the Scala 3...
canonical: https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Porting the Scala 2 optimizer to Scala 3 | daily.dev
og:description: The Scala 2 compiler's optimizer, which inlines and simplifies high-level code like map calls into fast low-level loops, is being ported to the Scala 3...
og:url: https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn
og:image: https://api.daily.dev/og/posts/siGsT1wjn.png
og:image:alt: Porting the Scala 2 optimizer to Scala 3
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Porting the Scala 2 optimizer to Scala 3

**[The Scala Programming Language](https://daily.dev/sources/scala-lang)** · 8 min read · 0 upvotes · 0 comments

## Summary

The Scala 2 compiler's optimizer, which inlines and simplifies high-level code like map calls into fast low-level loops, is being ported to the Scala 3 compiler under a Sovereign Tech Fund investment coordinated by the Scala Center. Early microbenchmarks show 10-30% faster execution for high-level functional-style code. The work is available as of Scala compiler version 3.8.3-RC3, is opt-in via the -opt and -opt-inline flags, and has now reached feature parity with the Scala 2 version. Limitations include instruction cache pressure from excessive inlining, inability to inline recursive calls or private-field-accessing methods on the JVM, and risks when inlining across library boundaries with independently versioned dependencies.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.scala-lang.org/blog/2026/03/23/porting-the-optimizer.html>

## Questions this post answers

### What version of the Scala compiler includes the ported Scala 2 optimizer for Scala 3?

The ported optimizer is available starting with Scala compiler version 3.8.3-RC3. It brings the inlining-based optimizer from Scala 2 to Scala 3, achieving feature parity, and early microbenchmarks show 10-30% faster execution for high-level functional-style code such as array map operations, without requiring developers to rewrite code as manual loops.

_Developers tracking Scala compiler performance changes can follow updates like this on daily.dev._

### How do I enable the new optimizer in the Scala 3 compiler?

Pass the -opt flag to enable non-inlining optimizations, and use -opt-inline:... arguments to control which packages can have their calls inlined. For example, -opt-inline:**,!java.**,!org.example.* allows inlining everywhere except within the java package and directly within org.example. Run -opt-inline:help for more details.

_Teams evaluating new Scala compiler flags can keep pace with releases like this via daily.dev._

### Why can inlining library code across dependency versions be risky in Scala's optimizer?

Inlining library code is risky because if a dependency is compiled against version 1.3.6 but a bugfix ships in 1.3.7, the fix has no effect on already-deployed code if the optimizer inlined the buggy version directly into that code. For this reason, inlining across library boundaries should be limited to code within your own library or dependencies you control.

_Developers weighing compiler optimizations against dependency safety can track these tradeoffs on daily.dev._

## Similar posts on daily.dev

- [Scala 3.9 LTS released\!](https://daily.dev/posts/scala-3-9-lts-released--qzsoaklif) · The Scala Programming Language · 0 upvotes · 0 comments
- [Scala 3 slowed us down?](https://daily.dev/posts/scala-3-slowed-us-down--a2y88frfv) · Hacker News · 2 upvotes · 0 comments
- [IntelliJ Scala Plugin 2025.3 Is Out\!](https://daily.dev/posts/intellij-scala-plugin-2025-3-is-out--pvmkuemfk) · JetBrains · 1 upvotes · 0 comments
- [Scala 3.8 Support in the Scala Plugin](https://daily.dev/posts/scala-3-8-support-in-the-scala-plugin-uwgqstmu3) · JetBrains · 0 upvotes · 0 comments
- [jank now has its own custom IR](https://daily.dev/posts/jank-now-has-its-own-custom-ir-xb0nzvh5o) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#jvm](https://daily.dev/tags/jvm), [#scala](https://daily.dev/tags/scala), [#compiler-optimization](https://daily.dev/tags/compiler-optimization)

[View this post on daily.dev](https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Porting the Scala 2 optimizer to Scala 3","url":"https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn"},"datePublished":"2026-08-23T12:17:18.466Z","dateModified":"2026-08-23T12:20:27.442Z","description":"The Scala 2 compiler's optimizer, which inlines and simplifies high-level code like map calls into fast low-level loops, is being ported to the Scala 3...","image":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","thumbnailUrl":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","isAccessibleForFree":true,"articleSection":"The Scala Programming Language","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Scala Programming Language","logo":"https://media.daily.dev/image/upload/s--4Bql-UcX--/f_auto,q_auto/v1787487426/logos/scala-lang?_a=BAMAMicg0","url":"https://daily.dev/sources/scala-lang"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,jvm,scala,compiler-optimization","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Scala Programming Language","item":"https://daily.dev/sources/scala-lang"},{"@type":"ListItem","position":3,"name":"Porting the Scala 2 optimizer to Scala 3"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/porting-the-scala-2-optimizer-to-scala-3-sigst1wjn#faq","mainEntity":[{"@type":"Question","name":"What version of the Scala compiler includes the ported Scala 2 optimizer for Scala 3?","acceptedAnswer":{"@type":"Answer","text":"The ported optimizer is available starting with Scala compiler version 3.8.3-RC3. It brings the inlining-based optimizer from Scala 2 to Scala 3, achieving feature parity, and early microbenchmarks show 10-30% faster execution for high-level functional-style code such as array map operations, without requiring developers to rewrite code as manual loops. Developers tracking Scala compiler performance changes can follow updates like this on daily.dev."}},{"@type":"Question","name":"How do I enable the new optimizer in the Scala 3 compiler?","acceptedAnswer":{"@type":"Answer","text":"Pass the -opt flag to enable non-inlining optimizations, and use -opt-inline:... arguments to control which packages can have their calls inlined. For example, -opt-inline:**,!java.**,!org.example.* allows inlining everywhere except within the java package and directly within org.example. Run -opt-inline:help for more details. Teams evaluating new Scala compiler flags can keep pace with releases like this via daily.dev."}},{"@type":"Question","name":"Why can inlining library code across dependency versions be risky in Scala's optimizer?","acceptedAnswer":{"@type":"Answer","text":"Inlining library code is risky because if a dependency is compiled against version 1.3.6 but a bugfix ships in 1.3.7, the fix has no effect on already-deployed code if the optimizer inlined the buggy version directly into that code. For this reason, inlining across library boundaries should be limited to code within your own library or dependencies you control. Developers weighing compiler optimizations against dependency safety can track these tradeoffs on daily.dev."}}]}
```

