unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

bench/lookupperf/README.md

Table lookup benchmark

Times generated lookups that bench/xlang does not reach on their own, and General_Category on code points across the BMP and all planes:

@general_category.is_mark(c)
@composition.is_composition_excluded(c)
@bidi.get_mirrored(c, 1) // Bidi_Mirroring_Glyph
@general_category.lookup_general_category(c) // the trie alone
@ucd.general_category(c) is Ll // with the conversion to the enum
@ucd.general_category(c).group() is P

Run from the repository root:

moon bench ./bench/lookupperf --target native
moon bench ./bench/lookupperf --target wasm-gc
moon bench ./bench/lookupperf --target wasm
moon bench ./bench/lookupperf --target js

Each case visits a whole sample per iteration, so the @bench call overhead is amortized: all takes one scalar value per 97 across every plane, and bmp one per 7 below U+10000, where the smaller tables are dense. Paired brackets are covered by the bidi group of bench/xlang, and the special case mappings by its case group.

1# Table lookup benchmark23Times generated lookups that `bench/xlang` does not reach on their own, and4General_Category on code points across the BMP and all planes:56```moonbit7@general_category.is_mark(c)8@composition.is_composition_excluded(c)9@bidi.get_mirrored(c, 1) // Bidi_Mirroring_Glyph10@general_category.lookup_general_category(c) // the trie alone11@ucd.general_category(c) is Ll // with the conversion to the enum12@ucd.general_category(c).group() is P13```1415Run from the repository root:1617```sh18moon bench ./bench/lookupperf --target native19moon bench ./bench/lookupperf --target wasm-gc20moon bench ./bench/lookupperf --target wasm21moon bench ./bench/lookupperf --target js22```2324Each case visits a whole sample per iteration, so the `@bench` call overhead25is amortized: `all` takes one scalar value per 97 across every plane, and26`bmp` one per 7 below U+10000, where the smaller tables are dense. Paired27brackets are covered by the `bidi` group of `bench/xlang`, and the special28case mappings by its `case` group.29