Pr0Ger / protobuf3

Protocol buffers library for Python 3
Other
5 stars 5 forks source link

Speeding up parsing protobuf messages with the memoryview #9

Closed leovp closed 8 years ago

leovp commented 8 years ago

Parsing code has been rewritten to use memoryviews instead of iterators. There's a decent speedup of 50x in parse-only tests, and about 30-50% in parse-and-access-all-attributes tests. No changes made to the message building code.

protobuf3 with iterators: 0_old_protobuf

protobuf3 with memoryviews: 1_new_protobuf

The functionality remains untouched, except for the create_from_bytes() method no longer accepting anything but bytes (and bytearrays I think). But that's only logical.