Skip to content
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

Split encode/decode error policy #3

Closed
cppden opened this issue Sep 22, 2017 · 1 comment
Closed

Split encode/decode error policy #3

cppden opened this issue Sep 22, 2017 · 1 comment

Comments

@cppden
Copy link
Owner

cppden commented Sep 22, 2017

Provide separate control on error propagation for encoding and decoding.
Default is throw during encode but bool for encode to reduce sensitivity to DoS attacks (see benchmarks).

@cppden
Copy link
Owner Author

cppden commented Jun 16, 2018

according to latest benchmarks exception error handling is faster in 100 (a hundred, Karl!) times. thus current plan is to have it by default and no reason for split enc/dec.

bool return (current defaults):

Benchmark               Time           CPU Iterations
------------------------------------------------------
BM_encode_ok         1107 ns       1105 ns     625296
BM_encode_fail        213 ns        212 ns    3298930
BM_decode_ok         1359 ns       1356 ns     512868
BM_decode_fail       1112 ns       1110 ns     622017

exceptions (future defaults)

Benchmark               Time           CPU Iterations
------------------------------------------------------
BM_encode_ok           15 ns         15 ns   47323241
BM_encode_fail       1904 ns       1903 ns     367928
BM_decode_ok           23 ns         23 ns   31101858
BM_decode_fail       3919 ns       3916 ns     176466

@cppden cppden closed this as completed Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant