hanabi1224 / hanabi1224/Programming-Language-Benchmarks
Some improvements - C#
- Dominant language
- C#
- Stars
- 800
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
Very nice comparisons. Here are some improvements that can be made in C#
- Some cases use Span or Memory
[Link - Span, Memory](https://www.codemag.com/Article/2207031/Writing-High-Performance-Code-Using-SpanT-and-MemoryT-in-C)
- Some cases use ValueTask instead of Task
[Link - ValueTask](https://developpaper.com/how-to-use-valuetask-in-c/)
- For C# use Source Generator for **Json** (example below) and if possible bytes instead of string.
```
[JsonSerializable(typeof(Person))]
internal partial class MyJsonContext : JsonSerializerContext
{
}
```
```
Person person = new() { FirstName = "Jane", LastName = "Doe" };
byte[] utf8Json = JsonSerializer.SerializeToUtf8Bytes(person, MyJsonContext.Default.Person);
person = JsonSerializer.Deserialize(utf8Json, MyJsonContext.Default.Person):
```
[Link - Source Generator NET 6](https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.