Skip to content

Introduce FakeValuesContext and FAKE_VALUES_MAP #767

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

Merged
merged 1 commit into from
Apr 16, 2023

Conversation

snuyanzin
Copy link
Collaborator

@snuyanzin snuyanzin commented Apr 15, 2023

The idea behind this PR is to init FakeValues only once per FakeValuesContext (determined by locale, path, url, filename),
right now it generates new FakeValues each time if it is not a default locale

It will allow to reduce GC/memory cost.

Also it was mentioned at #759 at these comments #759 (comment) and #759 (comment)

The best benchmark illustrating improvement is time consumed for build (since junit5 tests in datafaker are running in concurrent mode)
e.g. here for this PR for ubuntu jdk17 it took 1 min, 0 sec[1] vs 1min 18 sec for the latest main[2]
same for jdk20 this PR [3] took 57 sec vs 1 min 14 sec for the latest main [4]
also locally mvn clean verify is about 10-15% faster

[1] https://github.com/datafaker-net/datafaker/actions/runs/4707215086/jobs/8348951734?pr=767#step:4:966
[2] https://github.com/datafaker-net/datafaker/actions/runs/4700592603/jobs/8335491257#step:4:967
[3] https://github.com/datafaker-net/datafaker/actions/runs/4707215086/jobs/8348951927?pr=767#step:4:970
[4] https://github.com/datafaker-net/datafaker/actions/runs/4700592603/jobs/8335491891#step:4:969

@codecov-commenter
Copy link

Codecov Report

Merging #767 (e7fc6c0) into main (e64dfa8) will increase coverage by 0.07%.
The diff coverage is 87.50%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main     #767      +/-   ##
============================================
+ Coverage     92.77%   92.84%   +0.07%     
- Complexity     2604     2633      +29     
============================================
  Files           282      284       +2     
  Lines          5161     5202      +41     
  Branches        533      537       +4     
============================================
+ Hits           4788     4830      +42     
+ Misses          245      244       -1     
  Partials        128      128              
Impacted Files Coverage Δ
.../java/net/datafaker/service/FakeValuesContext.java 85.29% <85.29%> (ø)
...rc/main/java/net/datafaker/service/FakeValues.java 83.76% <88.88%> (+2.61%) ⬆️
...java/net/datafaker/service/FakeValuesGrouping.java 91.30% <100.00%> (ø)
.../java/net/datafaker/service/FakeValuesService.java 83.97% <100.00%> (ø)

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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