Skip to content

PeterRK/ProtoCache.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProtoCache .NET

Alternative flat binary format for Protobuf schema. It' works like FlatBuffers, but it's usually smaller and surpports map. Flat means no deserialization overhead. A benchmark shows the Protobuf has considerable deserialization overhead and significant reflection overhead. FlatBuffers is fast but wastes space. ProtoCache takes balance of data size and read speed, so it's useful in data caching.

Protobuf ProtoCache FlatBuffers
Data Size 574B 780B 1296B
Decode + Traverse 2805ns 1139ns 2353ns

Without zero-copy technique, the C# version is slow.

See detail in C++ version.

Code Gen

protoc --pc.net_out=. test.proto

A protobuf compiler plugin called protoc-gen-pc.net is available to generate java package. The generated files are short and human friendly. Don't mind to edit them if nessasery.

Basic APIs

var pb = pb.Main.Parser.ParseFrom(raw);
raw = ProtoCache.Serialize(pb);

var root = new pc.Main(raw);

Serializing a protobuf message with ProtoCache.Serialize is the only way to create protocache binary at present. It's easy to access by wrapping the data with generated code.

Reflection

TODO

About

Alternative flat binary format for Protobuf schema

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages