icu4x
icu4x copied to clipboard
Improve Extraction of Power and SI Prefix from CLDR Units String & implement `strip_prefix` for `zerotrie`
This issue pertains to the get_power and get_si_prefix functions in the MeasureUnit struct in the experimental/unitsconversion/src/measureunit.rs file. These functions are responsible for extracting the power and SI prefix from a CLDR units string, respectively.
Right now, we are using just a bunch of if and else statements. Which is not the most efficient way.
Option 1:
- Use
zerotrieand store it. Because it will be used while extracting the measurementunit fromcldr-id
Aslo, implement strip_prefix in zerotrie
@Manishearth : lets use the if-else for now, until the performance is a problem.
@sffc: yes, but we need to wait until the implementation of strip_prefix
@robertbastian : I am not convinced that we need the zerotrie until we compare the performance.
Decision: use if-else until and test the usage of zerotrie performance after the implementation of strip_prefix in zerotrie.
LGTM: @younies , @sffc , @robertbastian , @Manishearth
ZeroTrie issue: https://github.com/unicode-org/icu4x/issues/4249