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.
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
add tests to increase enum serialization code coverage #40601
add tests to increase enum serialization code coverage #40601
Changes from 2 commits
b03a5a9
b3a2b9b
0a6a345
92f5a1b
bf62339
1b4227e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does this test end up taking (and roughly how much memory does it use up)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jacksondr5 Correct me if I'm wrong but I think it instantiates 2,097,152 (
1 << 21
) dictionaries.Is there something that we could do to reduce this number while keeping the coverage? Perhaps you could do
Serialize<MyEnum>
until you have the cache at the desired number and then callSerialize<Dictionary<MyEnum, int>>
on the desired edge cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try my hand at benchmark.net and post some comparisons between
VeryLargeAmountOfEnumsToSerialize
andVeryLargeAmountOfEnumDictionaryKeysToSerialize
so we can understand how long this takes and how serializing theDictionary<MyEnum,int>
compares to serializingMyEnum
s. Might take me a day or 2 depending on my day jobThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A rough estimate is sufficient (which probably doesn't need BDN, but feel free to go down that route).
If you run the tests locally from master, and then compare the test time of your branch (remove the outerloop from the attribute to try it), that should give you a general idea. I am looking for an order of magnitude. If the tests went from taking ~1 minute, to 2+, or if we are using up 100s of MB/GB of memory (on Windows, Task manager could show it), then the test is too resource intensive, and we would definitely keep it as outerloop, and try to make it simpler, if possible.
If not, then outerloop is good enough. I asked to understand whether we need this test to be outerloop or if it is fast enough to become part of innerloop.
@jozkee, can you help here and run the test on your local machine and see how much time this particular test is adding to the test run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base time running
dotnet build /t:test
:Time running after adding this new test:
@ahsonkhan I would consider keeping this test as
OuterLoop
considering that the test above,VeryLargeAmountOfEnumsToSerialize
, which uses a similar code minus the insane amount of dictionary instances, isalready signaled to run on
OuterLoop
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That sounds good.