Skip to content

Commit

Permalink
benchmark: Use AsSpan() for MicrosoftMLTokenizer.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 15, 2024
1 parent 6413a0a commit dc95d21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task GlobalSetup()

[Benchmark]
[BenchmarkCategory("Encode")]
public IReadOnlyCollection<int> MicrosoftMLTokenizerV1_0_0_Encode() => _microsoftMlTiktoken.EncodeToIds(Data);
public IReadOnlyCollection<int> MicrosoftMLTokenizerV1_0_0_Encode() => _microsoftMlTiktoken.EncodeToIds(Data.AsSpan());

[Benchmark]
[BenchmarkCategory("Encode")]
Expand All @@ -62,7 +62,7 @@ public async Task GlobalSetup()

[Benchmark]
[BenchmarkCategory("CountTokens")]
public int MicrosoftMLTokenizerV1_0_0_() => _microsoftMlTiktoken.CountTokens(Data);
public int MicrosoftMLTokenizerV1_0_0_() => _microsoftMlTiktoken.CountTokens(Data.AsSpan());

[Benchmark]
[BenchmarkCategory("CountTokens")]
Expand Down

0 comments on commit dc95d21

Please sign in to comment.