Skip to content

Severe compile performance regression for Seq.++ chain #24550

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB in valerylobachev/data-dictionary-builder - build logs which now timeouts after 2h of compilation.
Discovery of the issue was delayed due to other errors previously reported in this project: #24207 and #24456

Every additional Seq[Message].++ in the chain dramatically increases the time required to compile snippet.

Under scala compile -S 3.7.4 test.scala --server=false all snippets compile in ~4s

Under scala compile -S 3.nightly test.scala --server=false 8th ++ invocation in the chain the performance starts to be easily visible, and starts to double/triple with each addition ++ in the chain

Compiler version

3.8.0-RC2

Last good release: 3.8.0-RC1-bin-20250818-aaa39c5-NIGHTLY
First bad release: 3.8.0-RC1-bin-20250819-1f13619-NIGHTLY
Bisect points to 1f13619 / #23769

Minimized code

trait Item
private def items : Seq[Item] = ???

def Test(): Seq[Item] =
  items ++
    items ++
    items ++
    items ++
    items ++
    items ++
    items ++ // 5s
    items ++ // 5s
    items ++ // 7s
    items ++ // 12s
    // items ++ // 25s
    // items ++ // 64s
    // items ++ // 188s
    items

Output

Expectation

Compille time should be similar as on the Scala 3.7.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions