Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the sandbox/Benchmark project to use newer NuGet packages (notably Tomlyn and CsToml), and adjusts benchmark code to align with the updated Tomlyn APIs and new benchmark scenarios.
Changes:
- Upgraded Tomlyn package version and bumped CsToml package references used under the
NuGetCsTomlconfiguration. - Updated Tomlyn benchmark calls to use
TomlSerializerAPIs, and added a Tomlyn source-generator context for AOT/trimming-friendly benchmarks. - Added a dedicated CsToml “from UTF-8 bytes” parse benchmark path and changed benchmark run preset from
ShortRuntoMediumRun.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sandbox/Benchmark/Program.cs | Updates the debug-time quick run to invoke the new UTF-8 parse benchmark method. |
| sandbox/Benchmark/Model/Model.cs | Introduces a Tomlyn source-generator context configured for snake_case naming. |
| sandbox/Benchmark/Config/BenchmarkConfig.cs | Switches benchmark jobs from ShortRun to MediumRun (affects runtime/throughput). |
| sandbox/Benchmark/Benchmark/ParseBenchmark.cs | Adds cached UTF-8 input and updates Tomlyn parse benchmarks to TomlSerializer.Deserialize. |
| sandbox/Benchmark/Benchmark/ClassSerializationBenchmark.cs | Adds Tomlyn reflection options and a new source-generator serialization benchmark. |
| sandbox/Benchmark/Benchmark/ClassDeserializationBenchmark.cs | Adds Tomlyn reflection options and a new source-generator deserialization benchmark. |
| sandbox/Benchmark/Benchmark.csproj | Upgrades Tomlyn package and updates CsToml package versions used for the NuGet-based benchmark job. |
Comments suppressed due to low confidence (13)
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:111
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:163
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly. Also, the local name 'document' is misleading since the type is TomlTable.
var document = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
return document;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:217
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:271
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:325
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:376
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:427
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:478
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:532
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:588
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:641
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ParseBenchmark.cs:693
- TomlSerializer.Deserialize() returns a nullable reference; using the null-forgiving operator here can hide parse failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var table = TomlSerializer.Deserialize<Tomlyn.Model.TomlTable>(tomlUtf16Text)!;
sandbox/Benchmark/Benchmark/ClassDeserializationBenchmark.cs:105
- TomlSerializer.Deserialize(...) returns a nullable reference; using the null-forgiving operator here can hide failures and can result in returning null from a method that declares a non-null return type. Prefer throwing (or otherwise handling) the null case explicitly.
var obj = TomlSerializer.Deserialize(tomlUtf16TextInSnakeCase, TomlynContext.Default.TestTomlSerializedObjectInSnakeCase)!; // Tomlyn (source generator)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR upgrades nuget package used in
sandbox/Benchmarkproject.