You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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#L509You can see from the trace that
new StringSegmentandModelStateNode.GetNodewere not inlined, so I immediately suspectstring.IndexOfAnywhich 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.