Introduce FakeValuesContext and FAKE_VALUES_MAP#767
Merged
Conversation
Codecov Report
📣 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
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
snuyanzin
added a commit
to snuyanzin/datafaker
that referenced
this pull request
May 2, 2023
snuyanzin
added a commit
to snuyanzin/datafaker
that referenced
this pull request
May 2, 2023
snuyanzin
added a commit
that referenced
this pull request
May 2, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 verifyis 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