From dc95d21c3b7f025660fe249cd582ba15da2f843a Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 15 Nov 2024 13:27:19 +0400 Subject: [PATCH] benchmark: Use AsSpan() for MicrosoftMLTokenizer. --- src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs b/src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs index 60c50a2..f096ccd 100644 --- a/src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs +++ b/src/benchmarks/Tiktoken.Benchmarks/Benchmarks.cs @@ -41,7 +41,7 @@ public async Task GlobalSetup() [Benchmark] [BenchmarkCategory("Encode")] - public IReadOnlyCollection MicrosoftMLTokenizerV1_0_0_Encode() => _microsoftMlTiktoken.EncodeToIds(Data); + public IReadOnlyCollection MicrosoftMLTokenizerV1_0_0_Encode() => _microsoftMlTiktoken.EncodeToIds(Data.AsSpan()); [Benchmark] [BenchmarkCategory("Encode")] @@ -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")]