Skip to content

Introduce cache of default schemas to FakeResolver - #809

Merged
snuyanzin merged 1 commit into
datafaker-net:mainfrom
RVRhub:fake_population_cache
Apr 30, 2023
Merged

Introduce cache of default schemas to FakeResolver#809
snuyanzin merged 1 commit into
datafaker-net:mainfrom
RVRhub:fake_population_cache

Conversation

@RVRhub

@RVRhub RVRhub commented Apr 30, 2023

Copy link
Copy Markdown
Contributor

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