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 space required by idna data tables #291

Merged
merged 1 commit into from Apr 3, 2017

Commits on Mar 24, 2017

  1. reduce space required by idna data tables

    The `Range` type defined by uts46 takes up 20 bytes on a 32-bit platform
    and 32 bytes on a 64-bit platform.  This bloat is due to `Mapping` using
    a full word-width discriminant for its type and native string slices,
    which are unnecessarily large.  The use of native string slices in this
    context also require many load-time relocations on some platforms when
    idna is used in a static library, another unnecessary cost.
    
    Instead of this scheme, we can define our own string slice type that
    indexes into a generated table.  This string slice type enables us to
    use a smaller discriminant type for `Mapping`, and therefore reduces the
    size of `Range` to 16 bytes on a 32-bit platform and 16 bytes on a
    64-bit platform.  For x86-64 Linux, this change reduces total idna size
    by ~130K, a significant savings.
    
    Changing the script to use unicode escapes makes things slightly more
    readable, enables better eyeball comparisons of the generated tables to
    the original mapping table, and makes syntax highlighting in emacs
    somewhat faster.
    froydnj committed Mar 24, 2017
You can’t perform that action at this time.