Giter Club home page Giter Club logo

Comments (1)

fxamacker avatar fxamacker commented on June 12, 2024

CCF codec is almost ready for initial reviews. PR will be opened to add it to onflow/cadence within 1-2 days.

Preliminary Size and Benchmark Comparisons

We are not comparing apples to apples. Prior formats (CBF and JSON-Cadence Data Interchange) didn't specify requirements for validity, sorting, etc.

  • CCF encoder sorts events data for deterministic encoding.
  • CCF decoder verifies that events data are well-formed and sorted.

At this time, CCF decoder doesn't include the option to check for "Preferred Serialization" (encoding to smallest size).

Size Comparisons

Encoding Event Count Encoded size Comments
JSON 48,309 13,858,836 JSON-Cadence Data Interchange Format
CCF 48,309 6,159,931 CCF in fully self-describing and deterministic mode

CCF's partially self-describing mode would be even smaller (roughly 1/4 the size of JSON) in some use cases.

Speed and Memory Comparisons

                     │ 48k_events_encode_json.log │     48k_events_encode_ccf.log       │
                     │           sec/op           │   sec/op     vs base                │
EncodeBatchEvents-20                 89.84m ± 17%   69.28m ± 3%  -22.88% (p=0.000 n=10)

                     │ 48k_events_encode_json.log │      48k_events_encode_ccf.log       │
                     │            B/op            │     B/op      vs base                │
EncodeBatchEvents-20                 32.45Mi ± 0%   25.82Mi ± 0%  -20.45% (p=0.000 n=10)

                     │ 48k_events_encode_json.log │     48k_events_encode_ccf.log       │
                     │         allocs/op          │  allocs/op   vs base                │
EncodeBatchEvents-20                  756.6k ± 0%   370.4k ± 0%  -51.05% (p=0.000 n=10)
                     │ 48k_events_decode_json.log │     48k_events_decode_ccf.log       │
                     │           sec/op           │   sec/op     vs base                │
DecodeBatchEvents-20                  646.2m ± 8%   158.3m ± 5%  -75.50% (p=0.000 n=10)

                     │ 48k_events_decode_json.log │      48k_events_decode_ccf.log       │
                     │            B/op            │     B/op      vs base                │
DecodeBatchEvents-20                234.97Mi ± 0%   56.16Mi ± 0%  -76.10% (p=0.000 n=10)

                     │ 48k_events_decode_json.log │     48k_events_decode_ccf.log       │
                     │         allocs/op          │  allocs/op   vs base                │
DecodeBatchEvents-20                  4.746M ± 0%   1.288M ± 0%  -72.86% (p=0.000 n=10)

Event Data Details

The 48,309 events are from a transaction on mainnet with unusually high number of events.

There were 9 event types. These 3 event types had over 15,000 events each: FlowToken.TokensDeposited, FlowToken.TokensWithdrawn, FlowIDTableStaking.DelegatorRewardsPaid

To simplify benchmark code (it's Sunday night), all event values for each event type are the same (i.e. the values are from the first event of that type).

from ccf_draft.

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.