Code Monkey home page Code Monkey logo

Comments (5)

sapek avatar sapek commented on August 14, 2024

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.

zapov avatar zapov commented on August 14, 2024

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.

sapek avatar sapek commented on August 14, 2024

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.

sapek avatar sapek commented on August 14, 2024

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.

zapov avatar zapov commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.