Skip to content

Instantly share code, notes, and snippets.

View neuecc's full-sized avatar

Yoshifumi Kawai neuecc

View GitHub Profile
// Install-Package MsgPack.Cli
// Install-Package Newtonsoft.Json
// Install-Package protobuf-net
// Install-Package ZeroFormatter
using MsgPack.Serialization;
using Newtonsoft.Json;
using ProtoBuf;
using System;
using System.Collections.Generic;
@neuecc
neuecc / result.txt
Created November 7, 2016 17:23
Benchmark result of ZeroFormatter - https://github.com/neuecc/ZeroFormatter/
Warming-up
ZeroFormatter
ZeroFormatter
protobuf-net
protobuf-net
MsgPack-CLI
MsgPack-CLI
JSON.NET
JSON.NET
Warming-up
ZeroFormatter
ZeroFormatter
ZeroFormatter
ZeroFormatter
ZeroFormatter
ZeroFormatter
Wire
Wire
@neuecc
neuecc / code.cs
Last active November 14, 2016 07:06
private void SerializeZeroFormatter()
{
var bytes = ZeroFormatter.ZeroFormatterSerializer.Serialize(Value);
RunTest("ZeroFormatter", () =>
{
ZeroFormatter.ZeroFormatterSerializer.Serialize(Value);
}, () =>
{
ZeroFormatter.ZeroFormatterSerializer.Deserialize<T>(bytes);
}, bytes.Length);

Test LargeStructTest

Running cold

ZeroFormatter
   Serialize                      45 ms
   Deserialize                    40 ms
   Size                           32 bytes
   Total                          85 ms
using System;
using System.Collections.Generic;
class Base { }
class A : Base { }
class B : Base { }
class Program
{
using Grpc.Core.Logging;
using System;
namespace MagicOnion
{
public class UnityDebugLogger : ILogger
{
readonly Type forType;
readonly string forTypeString;
public void Test()
{
Observable.ReturnUnit()
.SelectMany(_ => Observable.FromCoroutine(x => NestedCoroutine(x)))
.Subscribe(_ => Debug.Log("Very Good:)"));
}
IEnumerator NestedCoroutine(CancellationToken cancel)
{
yield return Observable.Timer(System.TimeSpan.FromSeconds(1))
// 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;
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
}