Investigate high exclusive time in MSD.GetNode #5362
Description
This is sampling data from the LargeJsonApi app using the POST test scenario:
The total time spent processing the request was 28s, and 3780ms of exclusive time (own time) was spent in ModelStateDictionary.GetNode(...)
. This is 13.5% of the app's processing time. https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Abstractions/ModelBinding/ModelStateDictionary.cs#L509
You can see from the trace that new StringSegment
and ModelStateNode.GetNode
were not inlined, so I immediately suspect string.IndexOfAny
which is implemented natively by the runtime. Our search space is generally constrained to dot-separate property names, which means the search text is small, and the number of delimiters we're looking for is 2. This seems like a good candidate for hand-optimizing.