-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Convert JitHashTable iteration to range-based for
#80265
Convert JitHashTable iteration to range-based for
#80265
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue Detailsnull
|
No diffs (as expected) but TP improvements around 0.22% |
@dotnet/jit-contrib PTAL |
@@ -11312,10 +11309,9 @@ void Compiler::JitTestCheckVN() | |||
{ | |||
printf("\nJit Testing: Value numbering.\n"); | |||
} | |||
for (NodeToTestDataMap::KeyIterator ki = testData->Begin(); !ki.Equal(testData->End()); ++ki) | |||
for (GenTree* const node : NodeToTestDataMap::KeyIteration(testData)) |
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.
iirc, we could simplify a lot of this by declaring something like the following in NodeToTestDataMap
public:
using const_iterator = NodeToTestDataMap::KeyIteration;
That should allow simply for (GenTree* const node : testData)
which is a lot simpler and doesn't require line wrapping/etc
Provided we don't need multiple iterators dealing with the same type, everything should work out nicely.
We should likewise be able to annotate whether they are "random access" or "contiguous" if that is important.
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.
Actually, looks like it just needs begin
and end
The using iterator
and using const_iterator
can also help with some templating and other scenarios, but aren't strictly required to use for (T item : data)
No description provided.