Skip to content

Instantly share code, notes, and snippets.

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<BenchmarkArraySplit>();
[MemoryDiagnoser]
public class BenchmarkArraySplit
{
[Benchmark]
public string Vabka()
public static class VarInt {
public static bool TryRead(ReadOnlySpan < byte > slice, out int value, out int readBytes) {
readBytes = 0;
value = 0;
var shift = 0;
while (true) {
if (readBytes >= slice.Length)
return false;
var nextByte = slice[readBytes++];