The elements of a DictionaryAttr are sorted by name. In many situations, e.g NamedAttributeList, we can guarantee that the elements are sorted on construction and remove the need to perform extra checks. In places with lots of calls to attribute methods, this leads to a good performance improvement.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks, this will fit the bill well :-)
mlir/include/mlir/IR/Attributes.h | ||
---|---|---|
281 | Set confuses me here, is it meant to convey unordered? (an alternative is just to say array or vector as by default there is no assumption that it would be sorted specially IMHO) |
mlir/lib/IR/Attributes.cpp | ||
---|---|---|
101 | Attr guarantees null termination because it uses Identifier. |
mlir/lib/IR/Attributes.cpp | ||
---|---|---|
101 | Oh I was on my phone and mis-read This is correct even when attr.first.data() is not a zero terminated string Actually the comment is adding more confusion than it helps for me: the comparison is obviously correct as long as attr is null terminated. |
Set confuses me here, is it meant to convey unordered? (an alternative is just to say array or vector as by default there is no assumption that it would be sorted specially IMHO)