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

Idea: more efficient build strategy #178

Open
lxgreen opened this issue Apr 2, 2021 · 2 comments
Open

Idea: more efficient build strategy #178

lxgreen opened this issue Apr 2, 2021 · 2 comments

Comments

@lxgreen
Copy link
Contributor

lxgreen commented Apr 2, 2021

Hey ultra people,

Thanks for this cool piece of code!

I'd like to share an idea. As far as I understand, currently ultra cache relies on git file hash for change detection in files, and timestamps for change detection in directories. I can see, the cache does not include the build artifact caches (e.g. in my project, the cache contains an entry for dist directory, but not for its contents).

What if the cache would contain entries for build artifacts as well, while their hashes are affected by the contents (e.g. md5 checksum)? This would provide actual change detection. Say, I've just changed a typescript annotation or a comment in package A. This change triggers package A rebuild. After the package is rebuilt, we compare bundle checksums vs cached ones. Since the change is dev-time only, it doesn't affect the bundle contents, so the rebuild can stop here and the dependent packages don't have to be rebuilt.

WDYT?

@folke
Copy link
Owner

folke commented Apr 7, 2021

I thought about something like that when I implemented ultra, but having to calculate checksums for all build artifacts might slow-down the builds quite a bit.

Triggering a rebuild on mtime changes of those directories should work for most cases and only sometimes do a build that night not have been needed.

@lxgreen
Copy link
Contributor Author

lxgreen commented Apr 7, 2021

Agree on that, in general. Hopefully, I'll find time to make POC to see the checksum calculation impact. This calculation supposed to run after the build is complete, so if it could run somehow in the background in non-blocking manner... 🤔

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

No branches or pull requests

2 participants