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

Avoid rewriting files with identical contents #368

merged 1 commit into from Sep 2, 2019


Copy link

commented Aug 14, 2019

I think sbt handles this reasonably (by hashing file contents), but it appears that maven pays more attention to file modification times. It slows down things enough already that guardrail runs each time a build is run, but having to recompile files that haven't changed just adds insult to injury.

  1. Running guardrail for the first time should have roughly the same performance (an extra stat() per file, which will fail since the file doesn't exist).
  2. Running guardrail when files need to be updated will be either roughly the same or a bit slower, depending: a) if the file sizes are different, it's just a stat() plus integer comparison extra, so roughly the same; b) if the file sizes are the same, it has to read the existing file off disk and compare, so things will be a bit slower.
  3. Running guardrail when files exist already and don't need to be updated should be slightly faster (an extra stat() and integer comparison, as well as reading the existing file off disk to compare, but no write of the file).

Of course, guardrail still has to do all the work to render the new files' contents to memory no matter what; in general that should be the dominating time factor. There's only one case that ends up being worst (where "worst" is probably a few hundreds of nanoseconds per file extra), which should be the very, very, very uncommon case (as it requires the files to be different, but also the same size).

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

@kelnos kelnos requested a review from blast-hardcheese Aug 14, 2019

Copy link

left a comment

Looks good

@blast-hardcheese blast-hardcheese merged commit 1840d47 into twilio:master Sep 2, 2019

1 check passed

Travis CI - Pull Request Build Passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.