Closed cheqianh closed 1 year ago
One example,
Benchmark:
import time
import cbor
import cbor2
o = 9233720363654371807
start = time.time()
for i in range(1000000):
cbor.dumps(o)
print(time.time() - start)
Results cbor | cbor2 |
---|---|
0.85502s | 2.9855s |
cbor
has not been maintained since 2016. It also segfaults on self referential structures, and does not implement any tag support. In short, it cuts corners which, I believe, is why it's faster.
Alright, thanks for the response!
Hello!
I am new to cbor and recently looking into
cbor
andcbor2
, and having a question about what benefitscbor2
brings thatcbor
does not have?I experimented on their
dumps
/loads
APIs with some sample data (E.g. a 64 bits integer, an alphabet string). In short,cbor
uses less memory and usually runs faster.My guess is that
cbor2
implementsRFC 8949
whilecbor
is still targetingRFC 7049
? Is there any benefitscbor2
brings thatcbor
does not have? Please feel free to correct me or point out a documentation that I've missed.