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

Add benches for data provider constructors #2600

Closed
sffc opened this issue Sep 20, 2022 · 2 comments · Fixed by #2603
Closed

Add benches for data provider constructors #2600

sffc opened this issue Sep 20, 2022 · 2 comments · Fixed by #2603
Assignees
Labels
A-performance Area: Performance (CPU, Memory) C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) T-docs-tests Type: Code change outside core library

Comments

@sffc
Copy link
Member

sffc commented Sep 20, 2022

The data provider constructors are a big part of our startup cost. We should measure them and improve them if possible.

I think it's fine for the tests to measure the testdata versions of the providers.

@sffc sffc added T-docs-tests Type: Code change outside core library A-performance Area: Performance (CPU, Memory) C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) labels Sep 20, 2022
@sffc sffc self-assigned this Sep 20, 2022
@zbraniecki
Copy link
Member

I have initial tests from my harness against datetime component, simple datetime formatting.
Params:

  • style Medium, Medium
  • locale "en"
  • provider: StaticDataProvider (--all-keys, --all-locales): 12.4mb
  • date constructed from epoch
  • format to Rust string

Breakdown:

  • ICU4C
    • constructor: 12.881 µs
    • format: 1.4387 µs
    • total: 27.600 µs
  • ICU4X
    • provider: 42.943 µs
    • constructor: 6.1462 µs
    • format: 346.61 ns
    • total: 50.025 µs

Note: ICU4C total is larger than constructor+format which can be explained by caching. If I extract dtf constructor out of bench loop it probably performs some operations lazily on the first format and caches them.
ICU4X is more predictable - the total is the sum of 3 parts and extracting each one gives predictable total.

Summary - StaticDataProvider doesn't seem to be zero-cost and we should evaluate why and document it.

@zbraniecki
Copy link
Member

(if we extract provider constructor, then ICU4C is 27us, and ICU4X is 6.4us)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-performance Area: Performance (CPU, Memory) C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) T-docs-tests Type: Code change outside core library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants