Skip to content

Make Hubris archives Clone#63

Closed
labbott wants to merge 1 commit intomainfrom
add_clone
Closed

Make Hubris archives Clone#63
labbott wants to merge 1 commit intomainfrom
add_clone

Conversation

@labbott
Copy link
Copy Markdown
Contributor

@labbott labbott commented Apr 29, 2026

In at least one spot in humility this is a significant performance win

In at least  one spot in humility this is a significant performance
win
@mkeeter
Copy link
Copy Markdown
Collaborator

mkeeter commented Apr 29, 2026

Can you say more about why this helps? I'm nervous for two reasons:

  • Cloning an object that contains a Vec<..> is a code smell, because it has to reallocate and copy. I normally try to use an Arc instead (either wrapping the entire struct or converting the Vec<u8> to an Arc<[u8]>).
  • The RawHubrisArchive can be edited and then used to overwrite the original file. The overwrite function consumes the object; this is an API choice to make it harder to misuse. If the object can be cloned, it's easier to mess stuff up – multiple functions could have RawHubrisArchive handles, perform different edits, and the last overwrite call would win.

@mkeeter
Copy link
Copy Markdown
Collaborator

mkeeter commented Apr 29, 2026

Update: I put a few comments in oxidecomputer/humility#633, because I think we can avoid cloning the archive altogether.

@labbott
Copy link
Copy Markdown
Contributor Author

labbott commented Apr 29, 2026

Yep very good reasons not to do the clone and it turns out we don't need it

@labbott labbott closed this Apr 29, 2026
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

Successfully merging this pull request may close these issues.

2 participants