Skip to content

Conversation

rgrinberg
Copy link
Member

@rgrinberg rgrinberg commented Mar 21, 2023

Move the computation of digests to a background thread. For now, this is guarded behind a configuration option that requires this to be enabled.

Signed-off-by: Rudi Grinberg me@rgrinberg.com

@rgrinberg rgrinberg force-pushed the ps/rr/feature__async_digest_handling branch from 305bfba to bcb1472 Compare March 21, 2023 20:35
@Alizter
Copy link
Collaborator

Alizter commented Mar 21, 2023

Then bench shows a noticeable slowdown:

Compare main:

1 | 0.9362449645996094
2 | 0.9103691577911377
3 | 0.9048709869384766
4 | 0.9169681072235107
5 | 0.925853967666626

with this pr:

1 | 0.9660398960113525
2 | 0.9446120262145996
3 | 0.9524080753326416
4 | 0.9530608654022217
5 | 0.9539759159088135

Also the clear build times make this clearer:

Main: 107.39912676811218
PR:   111.15323400497437

@rgrinberg
Copy link
Member Author

Thanks for the initial numbers. This PR is waiting for a change in the way we handle digests to be more multi threading friendly.

@rgrinberg rgrinberg force-pushed the ps/rr/feature__async_digest_handling branch from bcb1472 to 88d0420 Compare April 14, 2023 19:00
@rgrinberg
Copy link
Member Author

@Alizter and @jchavarri this is worth benchmarking now

@Alizter
Copy link
Collaborator

Alizter commented Apr 18, 2023

New bench results:

main PR %diff
Clean 101.73068690299988 99.33992314338684 -2.37803%
Null 0.9008660316467285 0.9387650489807129
0.9166581630706787 0.8799121379852295
0.905055046081543 0.8913090229034424
0.9088449478149414 0.9316670894622803
0.9060719013214111 0.9277148246765137
Avg. 0.90749921798706 0.91387362480164 +0.699956%

And some benches on building Dune:

Main
Benchmark 1: ./dune.exe build @install --cache disabled
  Time (mean ± σ):      9.826 s ±  0.280 s    [User: 90.914 s, System: 28.879 s]
  Range (min … max):    9.290 s … 10.279 s    10 runs
PR
Benchmark 1: ./dune.exe build @install --cache disabled
  Time (mean ± σ):     10.206 s ±  0.342 s    [User: 91.557 s, System: 29.759 s]
  Range (min … max):    9.916 s … 11.012 s    10 runs

The first bench appears to be no slowdown, however the second result appears to tell me that there still is some slowdown on a clean build. This could be down to the fact that the second results use 20 jobs rather than 1.

@rgrinberg
Copy link
Member Author

@Alizter digests aren't computed for null builds.

@Alizter
Copy link
Collaborator

Alizter commented Apr 21, 2023

OK that makes sense. If I get a chance I will try to test some chunkier repos to see if the slight slowdown is constant or also scales.

@rgrinberg rgrinberg force-pushed the ps/rr/feature__async_digest_handling branch from 88d0420 to e5eec82 Compare May 27, 2023 13:15
@rgrinberg
Copy link
Member Author

@snowleopard this option is now under config.

Copy link
Collaborator

@snowleopard snowleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@snowleopard
Copy link
Collaborator

The PR description needs to be updated though (it claims too much?).

Compute file digests in background threads

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: fa4d841b-d0ce-412e-b84b-d2d53c0d7eb6 -->
@rgrinberg rgrinberg force-pushed the ps/rr/feature__async_digest_handling branch from e5eec82 to fc86d03 Compare May 28, 2023 11:55
@rgrinberg rgrinberg merged commit c129971 into main May 28, 2023
@rgrinberg rgrinberg deleted the ps/rr/feature__async_digest_handling branch May 28, 2023 15:30
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