Skip to content

chore: Change Scala native's release mode to ReleaseFull #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025

Conversation

He-Pin
Copy link
Contributor

@He-Pin He-Pin commented May 16, 2025

Motivation:
Better performance
refs: https://scala-native.org/en/stable/user/sbt.html#compilation-modes

Maybe because of the sjsonnet size is now from 7.2MB to 12MB

it's https://github.com/scalameta/scalafmt/blob/main/build.sbt#L342 ReleaseFull in scalafmt

@He-Pin
Copy link
Contributor Author

He-Pin commented May 17, 2025

Test with ReleaseFull
hepin@Mac ~ % hyperfine --warmup 10 "./out cmp.jsonnet"  
Benchmark 1: ./out cmp.jsonnet
  Time (mean ± σ):     252.8 ms ±   4.2 ms    [User: 137.3 ms, System: 12.2 ms]
  Range (min … max):   249.0 ms … 264.2 ms    10 runs
 
Test with ReleaseFast
hepin@Mac ~ % hyperfine --warmup 10 "./sjsonnet cmp.jsonnet"
Benchmark 1: ./sjsonnet cmp.jsonnet
  Time (mean ± σ):     225.9 ms ±   2.5 ms    [User: 138.9 ms, System: 12.0 ms]
  Range (min … max):   222.3 ms … 229.1 ms    11 runs

Seems ReleaseFull is slower for a one-time command app? @WojciechMazur

@He-Pin He-Pin marked this pull request as draft May 17, 2025 07:46
@He-Pin He-Pin marked this pull request as ready for review May 17, 2025 08:12
@He-Pin He-Pin marked this pull request as draft May 17, 2025 10:53
@stephenamar-db
Copy link
Collaborator

Is this ready

@He-Pin
Copy link
Contributor Author

He-Pin commented May 20, 2025

@stephenamar-db But the result binary size is bigger, and the benchmark for a single run is slower.

@He-Pin He-Pin marked this pull request as ready for review May 20, 2025 03:16
@stephenamar-db
Copy link
Collaborator

it probably takes longer to load the large binary in memory?

@He-Pin
Copy link
Contributor Author

He-Pin commented May 21, 2025

@stephenamar-db I think so.

@stephenamar-db stephenamar-db merged commit 447ce90 into databricks:master May 21, 2025
6 checks passed
@He-Pin He-Pin deleted the patch-4 branch May 21, 2025 05:25
@CertainLach
Copy link

it probably takes longer to load the large binary in memory?

Not sure how MacOS disk caching works, but hyperfine --warmup should remove all the difference in loading times

@He-Pin
Copy link
Contributor Author

He-Pin commented May 21, 2025

@CertainLach Thanks, I saw scalafmt is using ReleaseFull too, but the result binary with ReleaseFull is 12MB and ReleaseFast is 7.2MB, and when do local testing, I saw, ReleaseFast result seems faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants