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
add ValidateString option into decode #253
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liuq19
force-pushed
the
fix/add_validate
branch
from
August 8, 2022 02:29
9960fc4
to
648476c
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 8, 2022 02:31
648476c
to
4e6bd3f
Compare
AsterDY
force-pushed
the
fix/add_validate
branch
from
August 9, 2022 06:39
474d848
to
8899bb3
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 10, 2022 02:49
8f2b1c5
to
f2f07e5
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 10, 2022 02:52
f2f07e5
to
0955d9c
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 10, 2022 10:01
b92afe8
to
af3271b
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 10, 2022 10:04
af3271b
to
db489f2
Compare
liuq19
force-pushed
the
fix/add_validate
branch
from
August 10, 2022 10:05
db489f2
to
f186daf
Compare
liuq19
changed the title
add ValidString option into decode
add ValidateString option into decode
Aug 11, 2022
AsterDY
previously approved these changes
Aug 11, 2022
AsterDY
approved these changes
Aug 11, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MR 描述
为 unmarshal/decode 添加了 ValidateString 的可选项。开启后,decode 的时候可以校验 未转义的控制字符 (如 "\x00" )、检验 非法 utf-8 字符(如 "\xff")。
性能测试
不开 ValidateString 选项,无明显劣化
测试命令:
../bench.py -b "\"BenchmarkUnmarshalInterface/GolangSource_Sonic|BenchmarkUnmarshalConcrete/TwitterStatus_Sonic\"" -t 1000x -c
测试结果:
开 ValidateString 后,性能劣化约 2~3%
测试命令:
../bench.py -b "\"BenchmarkUnmarshalInterface/GolangSource_Sonic|BenchmarkUnmarshalConcrete/TwitterStatus_Sonic\"" -t 1000x -c
测试结果: