Skip to content

Optimize string-like portable Span APIs for Ordinal and OrdinalIgnoreCase #25156

@ahsonkhan

Description

@ahsonkhan

This is specific to portable span (and not fast span).

We do not need to allocate and call the string APIs when StringComparison is Ordinal or OrdinalIgnoreCase.

Similar to APIs like EndsWith/etc., add a non-allocating code path for CompareTo for Ordinal:
https://github.com/dotnet/corefx/blob/42d5370f8c6cec8d1961f54a0974e52b0562b0a7/src/System.Memory/src/System/MemoryExtensions.Portable.cs#L23

Also optimize for OrdinalIgnoreCase for all the string-like APIs.

See: dotnet/corefx#27319 (comment)

cc @tarekgh

Metadata

Metadata

Assignees

Labels

area-System.MemoryenhancementProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions