Skip to content

Optimize coverage data #7

@amake

Description

@amake

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions