Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Tell c_read_binary that it's decoding characters #212

Merged
merged 1 commit into from
Jun 28, 2016

Conversation

jparise
Copy link
Contributor

@jparise jparise commented Jun 23, 2016

These type and size hints let cython optimize the string decoding operation
to a pair of __Pyx_PyObject_AsString / __Pyx_decode_c_string() calls. This
is a lot more efficient than the previous code generation which invoked the
"encode" method on the abstract "py_data" object.

The performance improvement here varies based on how much string data exists
in the input buffer, but the benchmark suite shows a 40%+ speed improvement
with this change.

These type and size hints let cython optimize the string decoding operation
to a pair of `__Pyx_PyObject_AsString` / `__Pyx_decode_c_string()` calls. This
is a lot more efficient than the previous code generation which invoked the
"encode" method on the abstract "py_data" object.

The performance improvement here varies based on how much string data exists
in the input buffer, but the benchmark suite shows a 40%+ speed improvement
with this change.
@lxyu lxyu merged commit 073ec0b into Thriftpy:develop Jun 28, 2016
@lxyu
Copy link
Contributor

lxyu commented Jun 28, 2016

👍 Thanks for your contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants