Skip to content

Conversation

@marxin
Copy link
Contributor

@marxin marxin commented Jan 4, 2026

As discussed here davidlattimore/wild#1396 - we can easily shrink the CrelIterator by 16 bytes from 80B to 64B.

Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but also CrelIteratorState::index is unnecessary. We could modify CrelIteratorHeader::count as we iterate instead. And once we do that, CrelIteratorState is identical to Crel so we should just use that instead.

However, I think you should try to design wild so that needing significant numbers of the CrelIterator is unnecessary. You should be storing CrelIterator::data and CrelIterator::header at most once per SHT_CREL section. If you need to be able to start iteration at an arbitrary point in the section the additional information you need is the offset, number of relocations, and previous Crel, which I think comes to 40 bytes.

@marxin
Copy link
Contributor Author

marxin commented Jan 6, 2026

This is fine, but also CrelIteratorState::index is unnecessary. We could modify CrelIteratorHeader::count as we iterate instead. And once we do that, CrelIteratorState is identical to Crel so we should just use that instead.

Great idea!

However, I think you should try to design wild so that needing significant numbers of the CrelIterator is unnecessary. You should be storing CrelIterator::data and CrelIterator::header at most once per SHT_CREL section. If you need to be able to start iteration at an arbitrary point in the section the additional information you need is the offset, number of relocations, and previous Crel, which I think comes to 40 bytes.

Yeah, I know. To be honest, right now, once we need a slice of relocations with CRel, we allocate a vector and store there the entire content of the relocation sections. That's a no-go for the future - I've got an idea how to make it smarter.

@philipc philipc merged commit e1e24a0 into gimli-rs:master Jan 7, 2026
10 checks passed
@marxin marxin deleted the shrink-CrelIteratorHeader-struct branch January 7, 2026 09:54
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