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

Make Faker lazy #33

Merged
merged 1 commit into from
Feb 13, 2022
Merged

Make Faker lazy #33

merged 1 commit into from
Feb 13, 2022

Conversation

snuyanzin
Copy link
Collaborator

The PR makes Faker lazy.
It adds a map of class to provider and creates provider only when it was called first time instead of initialization of each of them in constructor.
Also it orders providers in abc order.

This also speeds up initialization of faker
before

Benchmark           Mode  Cnt    Score   Error   Units
JmhTest.initFaker  thrpt    5  138.761 ± 2.593  ops/ms

after

Benchmark                            Mode  Cnt    Score    Error   Units
JmhTest.initFaker                   thrpt    5  251.992 ±  2.641  ops/ms

@snuyanzin snuyanzin merged commit 5f5dcbc into datafaker-net:master Feb 13, 2022
@snuyanzin snuyanzin deleted the init3 branch February 14, 2022 11:35
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.

None yet

1 participant