New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode speedup, yajl_string_encode runtime cut from 150 ms to 100 ms #59

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@bpowers

bpowers commented Oct 5, 2011

I've done some profiling of an application of mine that uses yajl, and yajl_string_encode was consistently the most cpu intensive part of yajl. These 2 commits cut the total time spent in and below yajl_string_encode from ~150 milliseconds to ~100 milliseconds or so.

bpowers added some commits Oct 4, 2011

encode: use an on-stack buffer for 2-char escape sequences
When profiling my application, this sped up yajl_string_encode by
3.9%.
encode: don't check specific cases when the current char is large
Most characters don't get escaped.  According to the RFC, the only
character greater than '/' that gets escaped is '/'. Test for this
common case first, and only if the char is a candidate for escaping
check for the other escape cases.

This cuts an additional 29% off the runtime of yajl_string_encode
@lloyd

This comment has been minimized.

Owner

lloyd commented Nov 28, 2011

this is beautiful! I'll give it a profile.

@bpowers

This comment has been minimized.

bpowers commented Nov 28, 2011

great! let me know if you see any issues or have any questions

lloyd added a commit that referenced this pull request Nov 28, 2011

augment in-tree performance benchmark to assess serialization perform…
…ance as well as parsing performance. (provides a means to assess issue #59)
@lloyd

This comment has been minimized.

Owner

lloyd commented Nov 28, 2011

merged into the 2.1.0 branch. I expect to release this week. Notice 52c559d - I added a synthetic in-tree benchmark for serialization and this confirms your performance improvement.

Nice work, and thank you.

@lloyd lloyd closed this Nov 28, 2011

@bpowers

This comment has been minimized.

bpowers commented Nov 28, 2011

oh the benchmark is quite nice. thank you for the great library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment