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
Proposal: Use a single seed value per faker function invocation #2664
Labels
c: feature
Request for new feature
p: 1-normal
Nothing urgent
s: accepted
Accepted feature / Confirmed bug
s: on hold
Blocked by something or frozen to avoid conflicts
Milestone
Comments
ST-DDT
added
c: feature
Request for new feature
p: 1-normal
Nothing urgent
s: needs decision
Needs team/maintainer decision
labels
Feb 12, 2024
How would that work though with fake patterns since different fake patterns can have different numbers of placeholders? |
Fake would assume that the pattern requires multiple seed values and always derive at the start of the fake method. |
This was referenced Feb 14, 2024
Team Decision
|
ST-DDT
added
s: accepted
Accepted feature / Confirmed bug
and removed
s: needs decision
Needs team/maintainer decision
labels
Feb 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c: feature
Request for new feature
p: 1-normal
Nothing urgent
s: accepted
Accepted feature / Confirmed bug
s: on hold
Blocked by something or frozen to avoid conflicts
Clear and concise description of the problem
Glossary:
Currently when invoking a faker function it may consume an unknown number of seed values (0-n).
While that isn't bad by itself, it has the side effect, that any change to the implementation affects the user by generating different subsequent values. This is especially relevant for functions that generate multiple values such as multiple and unique, each of the generated elements affect the following elements generated in them and all elements afterwards.
Suggested solution
Let each method use only a single seed value by deriving it, if it uses more than one.
Each method would be responsible for itself to consume only a single seed value.
Important usage detail, the
fakerCore
instance must be passed on and used by any nested code.Deriving an instance does come at a performance cost, but we could make it cheap, if we keep that as a priority during the derive implementation and use standalone functions like teased in the code example.
E.g. by not re-initializing the twister from scratch, but only copy and transforming the state.
(We should measure though how much "re-initializing" vs "copy and transforming the state" actually has of a performance impact)
It also comes at a cost of additional code, we could hide that in our potential meta framework though.
This section is largely unrelated to this proposal and should just demonstrate, how the derive could be included in the potential meta framework.
Usage
Alternative
Don't change the current behavior.
Additional context
Relevant issues/PRs:
Potentially impacted issues/PRs:
We already talked about this feature quite a bit, but I would like to have this issue, to bring everybody on the same level.
And give everybody the chance to comment and react.
The text was updated successfully, but these errors were encountered: