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

more idna data slimming #365

Merged
merged 3 commits into from Jun 20, 2017
Merged

more idna data slimming #365

merged 3 commits into from Jun 20, 2017

Conversation

@froydnj
Copy link
Contributor

froydnj commented Jun 18, 2017

We can do a better job of packing the uts46 data:

  • We can merge identically-mapped entries that don't have an associated string slice. This saves ~10% space.
  • We can make slices smaller and pack them into Mapping better, which saves 25% space on 64-bit platforms. I think it might save half that on 32-bit platforms, but I didn't check.

Together these are good for ~42KB of space savings on a 64-bit platform.


This change is Reviewable

froydnj added 3 commits Jun 16, 2017
It's easier to merge identical mapping entries if we have a separate
representation of all the ranges we're going to print out.
There's no reason to store adjacent ranges that map to identical results
separately; we can store them as a single entry and save ~10% space.
StringTableSlice has an alignment of 2, given its u16 members.  The
byte_len field can always fit into a u8.  To give it an alignment of 1
so that it can pack well into a Mapping, we need to store the byte_start
member as separate u8 fields, and change Mapping's discriminant to a u8.

This change makes Range take up 12 bytes on a 64-bit system instead of
16, for a significant space savings.

LLVM ought to be able to optimize the load/load/shift/or recomposition
of byte_start into a single u16 load on unaligned architectures like
x86.  Current Rust does not do that, but an extra instruction or two is
worth a 25% space optimization.
@SimonSapin
Copy link
Member

SimonSapin commented Jun 20, 2017

Looks great, thanks!

This does not include an version number increment, but #351 does so if you don’t mind waiting a bit I’ll publish both together to avoid merge conflicts.

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jun 20, 2017

📌 Commit c018150 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Jun 20, 2017

Testing commit c018150 with merge 37557e4...

bors-servo added a commit that referenced this pull request Jun 20, 2017
more idna data slimming

We can do a better job of packing the uts46 data:

* We can merge identically-mapped entries that don't have an associated string slice.  This saves ~10% space.
* We can make slices smaller and pack them into `Mapping` better, which saves 25% space on 64-bit platforms.  I think it might save half that on 32-bit platforms, but I didn't check.

Together these are good for ~42KB of space savings on a 64-bit platform.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/365)
<!-- Reviewable:end -->
@froydnj
Copy link
Contributor Author

froydnj commented Jun 20, 2017

This does not include an version number increment, but #351 does so if you don’t mind waiting a bit I’ll publish both together to avoid merge conflicts.

That'd be great, thank you!

@bors-servo
Copy link
Contributor

bors-servo commented Jun 20, 2017

☀️ Test successful - status-travis
Approved by: SimonSapin
Pushing 37557e4 to master...

@bors-servo bors-servo merged commit c018150 into servo:master Jun 20, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.