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

Reduce generated target info compile-time/binary size #1272

Open
NobodyXu opened this issue Nov 5, 2024 · 1 comment
Open

Reduce generated target info compile-time/binary size #1272

NobodyXu opened this issue Nov 5, 2024 · 1 comment

Comments

@NobodyXu
Copy link
Collaborator

NobodyXu commented Nov 5, 2024

          If we want to reduce the binary size/compilation time, then I could think of two ideas:

First, split the target and TargetInfo into two arrays, this would help simplify the array, and might make binary search faster as more target can be in the cache.

For TargetInfo, we can store the string inline.

We can internalise the string into a one big &str and refer to it via index, we can simply use a u16 for base pointer.

The simplest impl is to use HashSet in gen-target-info to dedup them, and then concat them into one giant string, each terminated by \0 and assign them each a u16 based on the length within the giant string.

That will compress 16B &'static str on 64-bit platform to 2B, and should improve compile-time as well.

Though it looks like something out of scope for this ticket.

Originally posted by @NobodyXu in #1266 (comment)

@madsmtm
Copy link
Contributor

madsmtm commented Nov 5, 2024

First step here is to set up testing infrastructure to actually measure compile times and binary size

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

No branches or pull requests

2 participants