Skip to content
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

Introduce partition digests to avoid recomputing all rules for every build #1171

Closed
wants to merge 29 commits into from
Closed

Introduce partition digests to avoid recomputing all rules for every build #1171

wants to merge 29 commits into from

Conversation

kodek16
Copy link
Contributor

@kodek16 kodek16 commented Aug 22, 2018

This is an optimization that may be useful for users when they work on an application that has a lot of source dependencies, and recompile it after every change. Intuitively, in this case there is no need to rebuild the whole dependency graph all the time, since dependencies sources are not likely to change. The PR introduces partitions and partition digests to facilitate faster rebuilds after changes limited in scope.

A partition is usually a dune project, but for some targets that cannot be easily mapped to a project, separate target-specific partitions are created.

Partition digest should be used to determine whether rules for partition should be recomputed. If there were no changes in both partition files (in case of a single-target partition, there are none) and dependencies digests, then it's possible to skip rule generation phase altogether.

A project digest is meant to be used to determine whether
rules for a project should be regenerated. If there were
no changes in both project files and dependencies digests,
then it's possible to skip rule generation phase altogether.

Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
@kodek16 kodek16 requested a review from a user August 22, 2018 15:55
kodek16 added 13 commits August 22, 2018 17:01
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
@kodek16 kodek16 changed the title [WIP] Introduce project digests to avoid recomputing all rules all the time Introduce partition digests to avoid recomputing all rules for every build Aug 28, 2018
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
@ghost ghost mentioned this pull request Aug 31, 2018
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
Signed-off-by: Pavel Senchanka <pavel.senchanka@gmail.com>
@kodek16
Copy link
Contributor Author

kodek16 commented Sep 6, 2018

Feature-wise this should be fairly complete and ready for review. Right now partition cache is enabled for watch mode, and can be enabled for normal builds with --use-partitions flag.

Some rough benchmark data from the testing environment I've been using:

Hardware I used included an 8C/16T CPU. The workspace contained sources of Core, Async, Jenga, and their dependencies (~7200 rules as per dune rule counter). The testing executable depended on all of them, its code was a single print statement. I've been changing the print statement code to see the difference between rule generation time and the executable build time.

Without partition cache:
First build: 68.18s
Next builds (executable code changed, compiles): 1.43s
Next builds (executable code changed, errors): 1.24s
Next builds (no changes): 1.21s

With partition cache:
First build: 69.56s
Second build (required to complete partition cache): 2.57s
Next builds (executable code changed, compiles): 0.49s
Next builds (executable code changed, errors): 0.27s
Next builds (no changes): 0.24s

@kodek16
Copy link
Contributor Author

kodek16 commented Sep 19, 2018

Closing this as a more comprehensive and robust solution is proposed in #1280.

@kodek16 kodek16 closed this Sep 19, 2018
@kodek16 kodek16 deleted the project-digests branch September 19, 2018 11:58
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.

2 participants