Skip to content

[perf] investigate performance issue in LazySegtree with ModInt #20

@harry0000

Description

@harry0000

Summary

When using LazySegtree in the AtCoder Library Practice Contest, the program consumes a large amount of memory and results in TLE (Time Limit Exceeded). This issue is particularly noticeable when running under Scala Native.

Observed Behavior

Environment:

AtCoder 2023/1 Language Update - Google スプレッドシート

  • Scala 3.3.0 (Scala Native 0.4.14)
  • Scala (Dotty 3.3.0)
  • openjdk-20-jdk-headless

Contest tasks

Submissions

K - Range Affine Range Sum

case result time memory
max_random_00 TLE 5620 ms 1393420 KiB
max_random_01 TLE 5617 ms 1375172 KiB
max_random_02 TLE 5614 ms 1396188 KiB
random_00 TLE 5616 ms 1319488 KiB
random_01 TLE 5613 ms 1302620 KiB
random_02 AC 3710 ms 842776 KiB

(reference) L - Lazy Segment Tree

Hypotheses

  • Memory leak in Scala Native generated code

Steps to Reproduce

Tasks

  • Reproduce and confirm the issue
  • Run profiling (JMH, async-profiler, etc.)
  • Identify bottleneck
  • Propose optimization approach
  • Benchmark optimized version
  • Create pull request

Related

Notes

Previously, the AtCoder administrators uploaded the test cases for the AtCoder Library Practice Contest to Dropbox for me, but the public access has been temporarily suspended, so the test data is currently unavailable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions