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

Skip null categories when serializing. #251

Merged
merged 1 commit into from
Sep 18, 2020

Conversation

zbraniecki
Copy link
Member

When we serialize plural rules, we can safely skip empty categories.

This reduces the size on the disk:

▶ dust -s -d2 -b ./json-old
  50B   ┌── manifest.json
 9.6K   │ ┌── ordinal@1
  22K   │ ├── cardinal@1
  32K   ├─┴ plurals
  32K ┌─┴ json-old
▶ dust -s -d2 -b ./json
  50B   ┌── manifest.json
 4.9K   │ ┌── ordinal@1
  13K   │ ├── cardinal@1
  18K   ├─┴ plurals
  18K ┌─┴ json

@zbraniecki zbraniecki requested a review from sffc September 18, 2020 00:02
@zbraniecki zbraniecki self-assigned this Sep 18, 2020
@coveralls
Copy link

Pull Request Test Coverage Report for Build ea0eb3ceba64bcc5b06ed696e1ac82942991ecc1-PR-251

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 78.951%

Totals Coverage Status
Change from base Build 7cc838c31053e52d660c690be850bfdfbe899cb0: 0.0%
Covered Lines: 2153
Relevant Lines: 2727

💛 - Coveralls

@zbraniecki
Copy link
Member Author

I also see a modest improvement on the microbenchmark:

plurals/convert+select/fs
                        time:   [1.8451 us 1.8557 us 1.8702 us]
                        change: [-5.6253% -4.8749% -4.1690%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  1 (1.00%) low mild
  5 (5.00%) high mild
  7 (7.00%) high severe

plurals/select/fs       time:   [1.8258 us 1.8324 us 1.8392 us]
                        change: [-4.3913% -3.5502% -2.6586%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  7 (7.00%) high severe

plurals/construct/fs/10 time:   [383.39 us 385.23 us 387.16 us]
                        change: [-8.1226% -7.2399% -6.3760%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) low mild
  3 (3.00%) high mild
  6 (6.00%) high severe

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Nice!!

@zbraniecki zbraniecki merged commit f4093bb into unicode-org:master Sep 18, 2020
@zbraniecki zbraniecki deleted the skip-null branch October 19, 2020 15:49
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.

3 participants