Skip to content

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

Open
@NobodyXu

Description

@NobodyXu
          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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions