-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IJsonWriter / IJsonReader interfaces #7
Comments
I will not be implementing this at this time. The focus of the project is performance and not compatibility with other serialization library. Anything that require not been able to inline as much as possible or calling virtual calls through interface would not work for me at this time. If fork this project, then i can help contribute a possible solution to the fork. |
this is my POC version (no parsing, JsonWriter only): https://gist.github.com/dimzon/37aaf808409df1172da7 using System;
using System.Diagnostics;
namespace bench
{
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public DateTime BurthDay { get; set; }
public string[] Certificates { get; set; }
}
class Program
{
static void Main(string[] args)
{
var obj = new Person {Name = "dimzon", Age = 36, BurthDay = new DateTime(1978, 11, 27, 22, 11, 0), Certificates = new []{"MCPD:EAD","MCTS:MSSQL"}};
//warmup
for (var i = 0; i < 1000000; ++i)
{
NetJSON.NetJSON.Serialize(obj);
DimzonNetJSON.DimzonNetJSON.Serialize(obj);
}
const int count = 2000000;
var tw = new Stopwatch();
for (var j = 0; j < 10; ++j)
{
tw.Restart();
for (int i = 0; i < count; ++i)
{
DimzonNetJSON.DimzonNetJSON.Serialize(obj);
}
tw.Stop();
Console.WriteLine("D " + tw.Elapsed);
tw.Restart();
for (int i = 0; i < count; ++i)
{
NetJSON.NetJSON.Serialize(obj);
}
tw.Stop();
Console.WriteLine("O " + tw.Elapsed);
}
}
}
} output:
|
I propose to move whole formatting/parsing logic to separate API. Something like:
this re-factoring allows custom implementation to support MsgPack|CBOR|BSON|UBSON|Smile|RISON etc...
The text was updated successfully, but these errors were encountered: