Skip to content

[wasm] Perf regression of Span.IndexOf #75709

@radekdoulik

Description

@radekdoulik

The performance of Span's IndexOf got worse with #73768 on wasm.

Visible in dotnet/perf-autofiling-issues#7981, dotnet/perf-autofiling-issues#7976 and here:
image

I think what is happening is that after the change we end up calling a shared generic method in the span helper, instead of an inflated one.

Stack trace before:

$corlib_System_SpanHelpers_IndexOf_byte__byte_int (dotnet.wasm:0x64acc)
$Wasm_Browser_Bench_Sample_Sample_SpanTask_IndexOfByte_RunStep (dotnet.wasm:0x4bddf0)
invoke_vii (dotnet.js:7557)
$Wasm_Browser_Bench_Sample_BenchTask_Measurement__RunBatchd__13_MoveNext (dotnet.wasm:0x4c0162)
...

after:

$corlib_System_SpanHelpers_IndexOfValueType_TValue_BYTE_TNegator_INST_TValue_BYTE__TValue_BYTE_int (dotnet.wasm:0x66aca)
$Wasm_Browser_Bench_Sample_Sample_SpanTask_IndexOfByte_RunStep (dotnet.wasm:0x4f9be2)
invoke_vii (dotnet.js:7557)
$Wasm_Browser_Bench_Sample_BenchTask_Measurement__RunBatchd__13_MoveNext (dotnet.wasm:0x4fbf53)
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions