Comments (5)
We do have benchmark we use internally to track performance although we have decided to not open source them (at least for now). As you know, benchmarks are a can of worms - if you try hard enough you can prove anything. That's why I would much prefer if a third party provided benchmarks for Bond than us. I'm aware of one such comparison to protobuf.net, albeit limited, which more or or less aligns with our internal results (C# Bond is 2-4 times faster, depending on schema, than protobuf.net).
FastBinary being slower than JSON definitely sounds wrong. It should be about an order of magnitude faster. You can find some discussion of tuning performance in Bond docs. I would also be happy to take a look at your benchmark code if you have it on GitHub.
from bond.
I wouldn't go that far and compare benchmarks to statistics. I always appreciate well done benchmarks. Even if codecs differ from use case to use case.
Anyway, I've pushed the initial version to my bench and here is where I set up bond: https://github.com/ngs-doo/json-benchmark/blob/master/Benchmark/Program.cs#L398
Not sure what I'm doing, but the numbers don't look good ;(
BondJson: 18598 / 46177 / error
BondBinary: 41032 / 47315 / 56397
for comparison:
Jil: 11703 / 15299 / 38717
Protobuf.NET: 7444 / 6796 / 31940
Revenj (JSON): 6348 / 10054 / 20339
Also, not sure how to go about few things ;(
For example I want to use Guid, DateTime (Date actually) and decimal. They don't look good in JSON as currently defined in shema. I can always convert them to String I guess, but that would kind of defeat the purpose.
Regards,
Rikard
from bond.
By default Bond pre-allocates a buffer of 64KB for its input/output streams. That might be a good default for a large application but definitely is too big for a benchmark testing with tiny objects. We end up measuring cost of memset :-).
The fix is trivial. I send you a PR.
BTW, when de/serializing from/to memory, you can get even better performance with Bond using ArraySegment<byte>
rather than streams. See the Performance section in the docs for more details.
from bond.
Regarding your other question about Guid/Date/Decimal: these are handled in Bond via type alias feature. You can choose which of the built-in types you want to alias. For instance, in the example we represent DateTime
as int64
but you could as well define it as an alias of string
and define appropriate conversion routines.
from bond.
Tnx, that fixes the problem with my bench. Although don't look like a good general solution, since other tests will use larger payload.
Now Bond really is faster than Revenj and Protobuf, although only from slightly faster to up to 50% faster.
I did use type aliases from your example, but as I said they were serialized strangely in JSON. I'll look into using string instead (but I suspect decimal will be quoted - which is not really correct).
I avoided ArraySegment since that would require me to either limit the amount of ram per thread/context or still leak memory ;(
Ah, now I have an excuse to improve Revenj speed ;(
from bond.
Related Issues (20)
- Bond generated headers don't work for clang in c++20 HOT 2
- Include enums in Bond runtime schema HOT 1
- cmake/Config.cmake looks for the EOLed Python-2.7 HOT 1
- Deserialization/serialization under Linux is 7x-10x slower than Windows HOT 2
- [C#] gbc.exe: Exec format error inside mcr.microsoft.com/dotnet/sdk:latest docker image. HOT 3
- "openFile: does not exist (No such file or directory)" on Linux HOT 3
- [C#] Deserializing bond-like strings into dynamic type HOT 2
- Linux build error - ghc: panic! HOT 4
- Support dotnet trimming HOT 5
- Target `netstandard2.0` for c# HOT 1
- C++: GCC: Double/Float comparison warning HOT 2
- Is this project still being maintained? HOT 2
- emit #nullable enable pragma in generated C# code
- bond on aarch64 is failing with unsupported LLVM
- [msvc][cpplatest] bond failed to build with msvc option /std:c++latest due to error C2027 and error C2061
- Upgrade to Stack lts-22.12 for aarch64 support
- Simple usage example for python HOT 1
- Is it possible to use Python bindings without Boost? HOT 1
- Compilation failed with msvc version 14.39.33519
- Following HLint suggestions?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bond.