Skip to content

Attempt to fix #3862#4064

Merged
rgrinberg merged 1 commit intoocaml:masterfrom
rgrinberg:fix-3862
Jan 6, 2021
Merged

Attempt to fix #3862#4064
rgrinberg merged 1 commit intoocaml:masterfrom
rgrinberg:fix-3862

Conversation

@rgrinberg
Copy link
Copy Markdown
Member

Memoize traces of globs. This is a naive attempt, and I'm not sure if it's
correct.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg rgrinberg requested a review from aalekseyev December 24, 2020 22:40
@aalekseyev
Copy link
Copy Markdown
Collaborator

Looks reasonable.
The correctness, of course, depends on if we ever modify (and refresh the Cached_digest for) files during a build after having computed its trace, but I don't think we do that.

Do you have any performance measurements of this change?

@rgrinberg
Copy link
Copy Markdown
Member Author

I'll prepare some benchmarks. Off the top of my head, dune's own build and other common projects aren't representative since they reuse globs that much. @Khady mind testing this?

@rgrinberg
Copy link
Copy Markdown
Member Author

@Khady ping on testing this.

@Khady
Copy link
Copy Markdown
Contributor

Khady commented Jan 6, 2021

Sorry I was on holidays, I didn't have time to look at this. Will try to schedule an attempt this week.

@Khady
Copy link
Copy Markdown
Contributor

Khady commented Jan 6, 2021

It looks like this version of dune doesn't provide dune.configurator anymore. And one of our dependencies needs it. So I am not able to try this PR currently.

@rgrinberg
Copy link
Copy Markdown
Member Author

It looks like this version of dune doesn't provide dune.configurator anymore. And one of our dependencies needs it. So I am not able to try this PR currently.

dune.configurator has been deprecated to dune-configurator a while ago, and dune has maintained this alias for a while. So I'm not sure what the problem is.

@rgrinberg
Copy link
Copy Markdown
Member Author

I did some benchmarking of this myself. I created a setup where

  • There's a directory with 10k small files
  • There's 20 rules that all depend on the directory above in a glob.

This PR makes clean builds around 2x faster (0.6s vs. 1.2s).

@aalekseyev
Copy link
Copy Markdown
Collaborator

Sounds great!

@rgrinberg rgrinberg merged commit f82f9f1 into ocaml:master Jan 6, 2021
@Khady
Copy link
Copy Markdown
Contributor

Khady commented Jan 7, 2021

My problem was with an old package that didn't declare explicitly the dependency on dune-configurator and was previously installed in the switch only by luck.

I gave a try to dune master after this branch was merged. The clean build of my project takes about the same time than with 2.7.1. The next dune build calls (so with nothing to build) take 6.5s with dune master vs 8.5s with dune 2.7.1 so there is a nice improvement even if 6.5s is still too long.

@rgrinberg
Copy link
Copy Markdown
Member Author

Could you profile with memtrace again with master? 6 seconds is indeed quite slow.

@Khady
Copy link
Copy Markdown
Contributor

Khady commented Jan 7, 2021

Yes, I will give it a go

@rgrinberg
Copy link
Copy Markdown
Member Author

While you're at it, could you give us a perf report as well? Would be quite useful.

@rgrinberg rgrinberg deleted the fix-3862 branch January 9, 2021 03:12
@Khady Khady mentioned this pull request Jan 11, 2021
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