View bench.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
using System.ComponentModel; | |
using System.Diagnostics.CodeAnalysis; | |
namespace SequenceReaderBenchmarks; | |
static class Program { |
View matrix.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Buffers; | |
int[][] matrix = | |
{ | |
new [] { 1,2,3,4 }, | |
new [] { 9,10,11,12 }, | |
new [] { 5,6,7,8 }, | |
}; | |
View benchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on StringUtilities from dotnet/aspnetcore | |
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
using System.Buffers; | |
using System.Diagnostics; |
View bench.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
using Grpc.Core; | |
using ProtoBuf.Grpc.Client; | |
using ProtoBuf.Grpc.Configuration; | |
using System.Collections.Concurrent; | |
using System.Runtime.CompilerServices; | |
BenchmarkRunner.Run<MyBenchmark>(); |
View bench.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
using Grpc.Core; | |
using ProtoBuf.Grpc.Client; | |
using ProtoBuf.Grpc.Configuration; | |
using System.Collections.Concurrent; | |
BenchmarkRunner.Run<MyBenchmark>(); |
View benchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
using System; | |
using System.Linq; | |
[MemoryDiagnoser] | |
public class ByteArrayChunker | |
{ | |
private readonly byte[] data; |
View gist:19e705577a60d2d99ea8e05b6becd25e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ProtoContract] | |
class Foo | |
{ | |
public JToken? Bar { get; set; } | |
[ProtoMember(1)] | |
[SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "Used for serialization")] | |
private string? BarSerialized | |
{ | |
get => Bar?.ToString(); |
View gist:b861a5d92afc113d3b3e7276fdb98932
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override bool TryGetArray(out ArraySegment<T> segment) | |
{ | |
if (typeof(T) == typeof(byte)) | |
{ | |
return MemoryMarshal.TryGetArray(Unsafe.As<Memory<byte>, Memory<T>>(ref Unsafe.AsRef(in this.memory)), out segment); | |
} | |
else | |
{ | |
segment = default; | |
return false; |
View sample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq.Expressions; | |
using System.Reflection; | |
using System; | |
static class P | |
{ | |
class Foo | |
{ | |
public Guid Value => _value; | |
private readonly Guid _value; |
View demo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ProtoBuf; | |
using ProtoBuf.Serializers; | |
using System; | |
using System.IO; | |
static class P | |
{ | |
static void Main() | |
{ |
NewerOlder