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

Optimize coverage data #7

Open
amake opened this issue Oct 29, 2024 · 0 comments
Open

Optimize coverage data #7

amake opened this issue Oct 29, 2024 · 0 comments

Comments

@amake
Copy link
Owner

amake commented Oct 29, 2024

The dart-more package uses the following scheme to encode Unicode properties and other Unicode data:

https://github.com/renggli/dart-more/blob/8d6470cebeb11887fc5f8fb54386429e924700cd/bin/generate_unicode.dart#L20-L33

  1. Generate a list of length 0x10ffff, filled with zeros

    Each bit in the numbers encodes the presence of a given property. For us, first bit is inclusion in e.g. iOS 8.0, second bit is iOS 8.1, etc. (Note: Up to 32 bits because on web JavaScript bitwise operations are limited to 32 bits)

  2. Loop over the data, setting all the bits. When we hit more than 32 properties, we make a new list.

    iOS has 65 releases covered, so we would need three lists. However only 22 releases have distinct data, so we could instead have a separate expansion mapping exemplar releases to a span of releases.

  3. Compress the lists with run-length encoding

  4. Store the compressed lists as generated source files

  5. In the app, decode the lists and use bitwise operations to test inclusion

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

1 participant