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

Introduce cache of default schemas to FakeResolver #809

Merged
merged 1 commit into from
Apr 30, 2023

Conversation

RVRhub
Copy link
Contributor

@RVRhub RVRhub commented Apr 30, 2023

Creating a Schema object from the FakeForSchema annotation can be time-consuming, as it involves reflection, when generating more than one object with a default schema using BaseFaker.populate(MyClass.class), the cache could increase significantly speed. The difference in speed is about 35%.
This pr solves this problem:

Before
Benchmark                                                 Mode  Cnt    Score    Error  Units
Datafaker_JavaObjectPopulateBenchmark.javaObjectPopulate  avgt   10  845.517 ± 56.535  ms/op

VS

After
Benchmark                                                 Mode  Cnt    Score    Error  Units
Datafaker_JavaObjectPopulateBenchmark.javaObjectPopulate  avgt   10  552.060 ± 25.132  ms/op

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