-
Notifications
You must be signed in to change notification settings - Fork 5
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
Hash the sysroot files metadata #16
Conversation
2b20750
to
2dd67fc
Compare
I assume that was in a pretty fast SSD though. I wonder how it fares on slower storage... |
With a Trying to come up with a realistic workload, I ran |
Okay, so that is noticeable, but it's a worst-case in terms of disk performance. Still, hashing the file sizes and mtimes should almost always be sufficient, shouldn't it? |
Well, it'll surely be a lot better than what we have now, and probably better than what Cargo does. And the worst-case looks like 107 ms (NVMe) or 225 ms (USB) which is an advantage. |
2dd67fc
to
18da29a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's just add a few for comments.
61df9d0
to
0157d06
Compare
Thanks. :-) |
@@ -84,6 +85,29 @@ fn make_writeable(p: &Path) -> Result<()> { | |||
Ok(()) | |||
} | |||
|
|||
/// Hash the metadata and size of every file in a directory, recursively. | |||
pub fn hash_recursive(path: &Path, hasher: &mut DefaultHasher) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason you made this public? Doesn't seem to me like we should expose this function from this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. I think I just didn't notice.
we properly rebuild the sysroot now when MIRI_LIB_SRC contents change Thanks to RalfJung/rustc-build-sysroot#16
we properly rebuild the sysroot now when MIRI_LIB_SRC contents change Thanks to RalfJung/rustc-build-sysroot#16
Worst-case (filesystem on a USB drive with the cache recently purged) time to hash the whole sysroot file contents looks like ~1 second. That seems a bit steep. Worst-case time to hash just the modification time and size of every file looks like 225 ms.
That's not perfect; a modification to a file that doesn't change size or modification time will cause spurious rebuilds from saving a file in an editor without changes, and if a file write happens to not change size or modification time we may fail to rebuild. Still a huge upgrade from nothing.