Skip to content

Commit a6bafc9

Browse files
committed
Modify JumpTableMultipleEntryBenchmark to use substring of entire path
1 parent 87ac8c0 commit a6bafc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Http/Routing/perf/Microbenchmarks/Matching/JumpTableMultipleEntryBenchmark.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void Setup()
2727

2828
for (var i = 0; i < _strings.Length; i++)
2929
{
30-
_segments[i] = new PathSegment(0, _strings[i].Length);
30+
_segments[i] = new PathSegment(1, _strings[i].Length - 2);
3131
}
3232

3333
var samples = new int[Count];
@@ -39,7 +39,9 @@ public void Setup()
3939
var entries = new List<(string text, int _)>();
4040
for (var i = 0; i < samples.Length; i++)
4141
{
42-
entries.Add((_strings[samples[i]], i));
42+
var sampleIndex = samples[i];
43+
var segment = _segments[sampleIndex];
44+
entries.Add((_strings[sampleIndex].Substring(segment.Start, segment.Length), i));
4345
}
4446

4547
_linearSearch = new LinearSearchJumpTable(0, -1, entries.ToArray());

0 commit comments

Comments
 (0)