Avoid duplicate hash computation during object creation#2549
Avoid duplicate hash computation during object creation#2549Sebastian Thiel (Byron) wants to merge 1 commit intomainfrom
Conversation
358e6cd to
3f11f85
Compare
3f11f85 to
f86f8d7
Compare
Jon Ross-Perkins (jonmeow)
left a comment
There was a problem hiding this comment.
Thanks! This looks good to me, just a couple questions about the Write trait changes (TBH I'm really just comparing with the non-known_id variants)
| let _ = id; | ||
| self.write_buf(object, from) |
There was a problem hiding this comment.
Should this mirror how write_buf calls write_stream? i.e.:
| let _ = id; | |
| self.write_buf(object, from) | |
| self.write_stream_with_known_id(id, object, from.len() as u64, &mut from) |
It looks like places like cache.rs omit write_buf, so this kind of call might let them omit write_buf_with_known_id similarly (though looking at the loose/write.rs changes which do provide write_buf, perhaps cache.rs should actually be forwarding write_buf?)
| size: u64, | ||
| from: &mut dyn io::Read, | ||
| ) -> Result<gix_hash::ObjectId, crate::write::Error> { | ||
| let _ = id; |
There was a problem hiding this comment.
Is it right to be discarding the id here (versus not providing a default implementation)? Maybe this is appropriate for backwards compatibility; if that's the intent, maybe worth a comment?
| let _ = id; | |
| // Provide a default implementation which discards the id. | |
| let _ = id; |
|
Jon Ross-Perkins (@jonmeow) Thanks so much for taking a look! I haven't looked at the code at all yet, but when I do I will particularly look at the places you are highlighting. |
Fixes #2516
Tasks