Parent issue: #5747
Problem
IRoutingMapProviderExtensions.GetTargetPartitionKeyRangesAsync() (src/Routing/IRoutingMapProviderExtensions.cs:126) accesses PartitionKeyRange.MaxExclusive inside a loop when computing overlapping ranges. Each access triggers JToken.ToObject<T>() deserialization.
Hot path assessment: WARM
Called O(N) per query where N is the number of target partition key ranges. For cross-partition queries targeting many partitions, this can be significant.
Suggested fix
Cache targetRanges.Last().MaxExclusive in a local variable before the comparison, or use Range<string> objects that already have materialized Max values.
Lines
IRoutingMapProviderExtensions.cs:126 targetRanges.Last().MaxExclusive
Constraint
PartitionKeyRange is in compiled NuGet (Microsoft.Azure.Cosmos.Direct) fix must be at the call site.
Parent issue: #5747
Problem
IRoutingMapProviderExtensions.GetTargetPartitionKeyRangesAsync()(src/Routing/IRoutingMapProviderExtensions.cs:126) accessesPartitionKeyRange.MaxExclusiveinside a loop when computing overlapping ranges. Each access triggersJToken.ToObject<T>()deserialization.Hot path assessment: WARM
Called O(N) per query where N is the number of target partition key ranges. For cross-partition queries targeting many partitions, this can be significant.
Suggested fix
Cache
targetRanges.Last().MaxExclusivein a local variable before the comparison, or useRange<string>objects that already have materialized Max values.Lines
IRoutingMapProviderExtensions.cs:126targetRanges.Last().MaxExclusiveConstraint
PartitionKeyRangeis in compiled NuGet (Microsoft.Azure.Cosmos.Direct) fix must be at the call site.