MarshalX / python-libipld

🏎️ Fast Python library to work with IPLD: DAG-CBOR, CID, CAR, multibase
https://pypi.org/project/libipld/
MIT License
17 stars 2 forks source link

Optimize string encoding #41

Closed MarshalX closed 7 months ago

MarshalX commented 8 months ago

explanation: read_str performs from_utf8 in rust side which is not necessary because performed from CPython side too

todo: investigate possibilities of invalid utf8 strings here and how it be handled

codspeed-hq[bot] commented 8 months ago

CodSpeed Performance Report

Merging #41 will improve performances by 12.68%

Comparing optimize-string-encoding (1dbfbbc) with main (1c0df5e)

Summary

⚡ 3 improvements ✅ 189 untouched benchmarks

Benchmarks breakdown

Benchmark main optimize-string-encoding Change
test_dag_cbor_decode_fixtures[garbage-06] 91 µs 82.2 µs +10.61%
test_dag_cbor_decode_fixtures[garbage-09] 117.6 µs 104.7 µs +12.32%
test_dag_cbor_decode_fixtures[garbage-23] 75.5 µs 67 µs +12.68%
MarshalX commented 8 months ago

weeelll requires more investigation

image
MarshalX commented 8 months ago

now twitter.json feels a little bit better (as expected in theory)

image
MarshalX commented 8 months ago

now it's even better!

image