-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fix global clear of unique values for Faker::UniqueGenerator #1355
Conversation
@MarcPer Could you take a quick look at this please? |
Sure, I'll take a look. |
This was a good test and it caught something I missed before. Whenever @kolasss 's change fixes this, but I would suggest an alternative, since removing the
With this, if any dangling instance of |
Just to be sure if my alternative suggestion wouldn't negatively impact the benchmarks, I redid what was described here with the proposed change, and the method using the The only new test I did was setting the second parameter in the benchmark function to higher values (20 and 40):
This means the |
Why not extract |
I think for the typical user, having to worry about the inner workings of the library and calling two methods instead of one shouldn't be necessary. As a user, I would like to clear the values so I can regenerate them, without being concerned of a list somewhere keeping the references. About the memory consumption, I would agree, except that the change that added the And what about my suggestion? Do you see any downside for using it? |
@MarcPer I think it's good. Should I create a new PR? |
@kolasss, I think you already did a good job with your unit tests - I don't see a need for creating a new PR. I would only do a new commit changing
|
Thanks for the discussion. I'll take a look later on and get it merged 👍 |
…uby#1355) * Fix global clear of unique values for Faker::UniqueGenerator * Update CHANGELOG.md
Global clear of unique values did not work after first global clear, test included