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

"Memoization" / work avoidance / don't run task if sources haven't changed #46

Open
agilgur5 opened this issue Oct 25, 2023 · 4 comments

Comments

@agilgur5
Copy link

agilgur5 commented Oct 25, 2023

Mentioned in #40 (comment) but didn't get an answer. I think this behavior is not currently supported.

Task supports specifying sources and generates and will perform a checksum or timestamp (checksum is the default, timestamp matches Make) check on those when specified. If the files listed in generates exist and the sources haven't changed, the task will not be run.

Make supports a similar feature by default that uses timestamps.

Would be good feature parity for Kit to support this, especially as it can result in using a lot less compute and time

@alexec
Copy link
Collaborator

alexec commented Jul 15, 2024

This seems like a really good idea. File hashes will be expensive to compute if there are many files, so we could use the modtime. I think this is what Make does.

@alexec
Copy link
Collaborator

alexec commented Jul 15, 2024

Note, this is only needed when starting up. The way that Make does this is that it compares the built file timestamp with the source file. If the built file is newer, then it is up-to-date, older then rebuild is needed.

@alexec
Copy link
Collaborator

alexec commented Jul 15, 2024

What about this syntax

# we watch these files
watch: [foo]
# when the task runs to completion and exit code 0, touch this file
touch: bar

@agilgur5
Copy link
Author

so we could use the modtime. I think this is what Make does.

Yes that's what I wrote above. Although modtime is imperfect as it will trigger when you save a file and there were no changes.

Note, this is only needed when starting up.

Does watch already check for this condition?

What about this syntax

I would think that if there's a watch, there's no need for another field, as those are the ones you'd check the timestamp or checksum against.

For tasks without outputs though, that might be useful

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