Skip to content

Comments

Benchmark for BoundLocaleDataProvider#7663

Draft
sffc wants to merge 21 commits intounicode-org:mainfrom
sffc:dname-experimentation
Draft

Benchmark for BoundLocaleDataProvider#7663
sffc wants to merge 21 commits intounicode-org:mainfrom
sffc:dname-experimentation

Conversation

@sffc
Copy link
Member

@sffc sffc commented Feb 18, 2026

Issue: #3260

Merge of #7662 and #7621 with a benchmark.

$ ICU4X_REGION_POSTCARD_PATH=../../_debug/regionnames.postcard cargo bench --all-features region

...

locale_names/region/postcard/all/1by1
                        time:   [6.8448 ms 6.9295 ms 7.0177 ms]
Found 6 outliers among 100 measurements (6.00%)
  6 (6.00%) high mild

locale_names/region/postcard/all/boundlocale
                        time:   [3.6443 ms 3.6895 ms 3.7372 ms]
Found 34 outliers among 100 measurements (34.00%)
  15 (15.00%) low severe
  1 (1.00%) low mild
  3 (3.00%) high mild
  15 (15.00%) high severe

I built regionnames.postcard like this: cargo run -p icu4x-datagen --all-features -- -m LocaleNamesRegionLongV1 CaseMapV1 PluralsCardinalV1 TimezoneNamesLocationsOverrideV1 --format blob -o _debug/regionnames.postcard

I included the target marker as well as a small handful of others to simulate walking through the marker trie.

@sffc
Copy link
Member Author

sffc commented Feb 18, 2026

I added a bench on the old ZeroMap struct:

locale_names/region/baked/all/1by1
                        time:   [5.9787 ms 6.0411 ms 6.1111 ms]
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild

locale_names/region/baked/all/old_map_struct
                        time:   [2.3787 ms 2.3947 ms 2.4130 ms]
Found 18 outliers among 100 measurements (18.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
  16 (16.00%) high severe

locale_names/region/postcard/all/1by1
                        time:   [6.9537 ms 7.0637 ms 7.1818 ms]
Found 14 outliers among 100 measurements (14.00%)
  13 (13.00%) high mild
  1 (1.00%) high severe

locale_names/region/postcard/all/boundlocale
                        time:   [3.3650 ms 3.3756 ms 3.3897 ms]
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) high mild
  9 (9.00%) high severe

@robertbastian
Copy link
Member

Can you add a benchmark for loading like 10 names? I don't think loading 300+ names at once is the most realistic use case.

@sffc
Copy link
Member Author

sffc commented Feb 18, 2026

Can you add a benchmark for loading like 10 names? I don't think loading 300+ names at once is the most realistic use case.

It is a realistic use case, because pickers have a lot of regions/languages, but I added one to load 10% of the names.

locale_names/region/baked/10x10pct/1by1
                        time:   [72.051 µs 72.475 µs 72.879 µs]
Found 17 outliers among 100 measurements (17.00%)
  5 (5.00%) low severe
  4 (4.00%) high mild
  8 (8.00%) high severe

locale_names/region/baked/10x10pct/old_map_struct
                        time:   [24.617 µs 24.832 µs 25.026 µs]

locale_names/region/postcard/10x10pct/1by1
                        time:   [68.274 µs 69.017 µs 69.688 µs]
Found 23 outliers among 100 measurements (23.00%)
  1 (1.00%) high mild
  22 (22.00%) high severe

locale_names/region/postcard/10x10pct/boundlocale
                        time:   [34.649 µs 34.948 µs 35.321 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

@sffc
Copy link
Member Author

sffc commented Feb 19, 2026

I want to point out that the benchmark performance is more dependent on the shape of the data build than the exact workload. I built a postcard file containing display names data for all regions and all locales. If I were to use a postcard file containing display names for only one locale, then the diff is going to be smaller.

sffc added a commit that referenced this pull request Feb 19, 2026
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.

2 participants