View benchmarkdotnettemplate.cs
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
class Program
{
static void Main(string[] args)
View StringSpan.cs
using System;
using System.Text;
public static class StringSplitExtensions
{
public static SplitCharEnumerator SplitSlice(this string str, char separator)
{
return new SplitCharEnumerator(str, separator);
}
View NumberConverter.cs
using System;
namespace MyNamespace
{
/// <summary>
/// UTF8(Ascii) ByteArray to Number Converter to avoid utf8 convert and number parsing.
/// </summary>
public static class NumberConverter
{
// loop unrolling(we know number length)
View PayloadFormatter.cs
public class PayloadFormatter : IMessagePackFormatter<Payload>
{
public Payload Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
{
throw new NotSupportedException("まぁいらんでしょう。");
}
public int Serialize(ref byte[] bytes, int offset, Payload value, IFormatterResolver formatterResolver)
{
var startOffset = offset;
View UnixtimestampResolver.cs
public sealed class UnixTimestampResolver : IFormatterResolver
{
public static readonly IFormatterResolver Instance = new UnixTimestampResolver();
UnixTimestampResolver()
{
}
public IMessagePackFormatter<T> GetFormatter<T>()
View IocPerformance.md

Note

This is modified edition of [IoCPerformance] https://github.com/neuecc/IocPerformance/tree/Resolve_T
It uses T Resolve<T> instead of object Resolve(Type type).

Results

Explantions

First value: Time of single-threaded execution in [ms]
Second value: Time of multi-threaded execution in [ms]

View Resolver.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
// Extremely fast micro serice locator.
namespace MicroResolver
View ActorPathFormatter.cs
internal static class ActorPathResolverGetFormatterHelper
{
// If type is concrete type, use type-formatter map
static readonly Dictionary<Type, object> FormatterMap = new Dictionary<Type, object>()
{
{typeof(ActorPath), new ActorPathFormatter<ActorPath>()},
{typeof(ChildActorPath), new ActorPathFormatter<ChildActorPath>()},
{typeof(RootActorPath), new ActorPathFormatter<RootActorPath>()}
};
View UnitTestLoader.cs
public static class UnitTestLoader
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Register()
{
// setup created test class to RegisterAllMethods<T>
UnitTest.RegisterAllMethods<SampleGroup>();
// and add other classes
}
View SampleGroup.cs
// make unit test on plain C# class
public class SampleGroup
{
// all public methods are automatically registered in test group
public void SumTest()
{
var x = int.Parse("100");
var y = int.Parse("200");
// using RuntimeUnitTestToolkit;