~qeef/draft-devault-bare

85d38d0f26074fee8d8f4e07823cb746f5383a78 — Jiri Vlasak 6 months ago 8116525
First pack cbor, then use
1 files changed, 4 insertions(+), 3 deletions(-)

M compare-bare-to-cbor.py
M compare-bare-to-cbor.py => compare-bare-to-cbor.py +4 -3
@@ 151,15 151,16 @@ def measure(number_of_msgs):
            "email": m.email,
            "address": m.address,
            "orders": m.orders})
    cbor_packed = cbor2.dumps(msgs_cbor)
    bare_len = len(msgs_bare.pack()) * 100.0 / raw_len
    bare_gz_len = len(gzip.compress(msgs_bare.pack())) * 100.0 / raw_len
    cbor_len = len(cbor2.dumps(msgs_cbor)) * 100.0 / raw_len
    cbor_gz_len = len(gzip.compress(cbor2.dumps(msgs_cbor))) * 100.0 / raw_len
    cbor_len = len(cbor_packed) * 100.0 / raw_len
    cbor_gz_len = len(gzip.compress(cbor_packed)) * 100.0 / raw_len
    json_len = len(json.dumps(msgs_cbor).encode("utf-8")) * 100.0 / raw_len
    json_gz = len(gzip.compress(json.dumps(msgs_cbor).encode("utf-8")))
    json_gz_len = json_gz * 100.0 / raw_len
    bare_gz_json = len(gzip.compress(msgs_bare.pack())) * 100.0 / json_gz
    cbor_gz_json = len(gzip.compress(cbor2.dumps(msgs_cbor))) * 100.0 / json_gz
    cbor_gz_json = len(gzip.compress(cbor_packed)) * 100.0 / json_gz
    return {
        "raw_len": raw_len,
        "bare_len": bare_len,