You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was facing some issues regarding slow generation with a relatively big faker that had a lot of nested entities.
so I tried parallel generation using parallel for each and using parallel enumerable, but both seemed to not change any thing. after finding this issue I tried changing my code to override the PopulateInternal method but found no difference at all
here are my benchmarks results(using benchmark dotnet).
Method
batchSize
Mean
'Normal Generation'
100
7.926 s
'Parallel Generation'
100
8.032 s
'Normal Generation'
1000
79.178 s
'Parallel Generation'
1000
79.887 s
Generally both methods scale with O(n) performance with the generation count.
I discovered this when trying to generate some data for benchmarks, that's why the count was large, for tests faker was fast enough. but for benchmarks generating the data takes ore than doing all the DB operations and it really struggled for several minutes when generating more than 10K
Note
My methods like AddressFaker.Create() are just static methods that return fakers for every entity with the appropriate rules
Bogus NuGet Package
35.6.5
.NET Version
.NET 9
Visual Studio Version
rider 2025.3
What operating system are you using?
Windows
What locale are you using with Bogus?
default,
Problem Description
I was facing some issues regarding slow generation with a relatively big faker that had a lot of nested entities.
so I tried parallel generation using parallel for each and using parallel enumerable, but both seemed to not change any thing. after finding this issue I tried changing my code to override the
PopulateInternalmethod but found no difference at allhere are my benchmarks results(using benchmark dotnet).
Generally both methods scale with O(n) performance with the generation count.
Note
My methods like
AddressFaker.Create()are just static methods that return fakers for every entity with the appropriate rulesLINQPad Example or Reproduction Steps
Expected Behavior
parallel generation should be faster
Actual Behavior
both methods perform the same and scale the same
Known Workarounds
No response
Could you help with a pull-request?
Yes