fix(cpp): stop TextFormat iteration if output stream fails#26237
fix(cpp): stop TextFormat iteration if output stream fails#26237jschroedr wants to merge 4 commits into
Conversation
|
Looks like you're out of date. Would you mind:
Thanks |
|
Hi @honglooker - confirming I've added a test showing how the update prevents TextFormat from printing beyond the point of failure. More specifically, the test stops exactly at the failure limit of 64 bytes and makes one attempt after failure, turning O(N) work into O(1) work once the output destination is reached. Note: I've included the verification in a standalone test file to ensure a clean build environment independent of the current experimental features in the main test suite. |
1c02d7f to
1f2f1d3
Compare
|
Huh, I recall the CLA being ✅ a few days ago - now it's red? You'll need to sign that before we proceed, thank you (maybe different email?) |
1f2f1d3 to
fb37c09
Compare
|
All set now @honglooker |
|
Just updated with the base branch - please let me know if anything else is needed. |
…cuiting early to prevent unnecessary work when the generator is in a failed state
|
Feedback has been addressed @JasonLunn - thank you for your time reviewing and please let me know if you need anything else. |
* Optimized @ref ugrpc::ToLimitedDebugString and logging middlewares for Protobuf v35+ (to be precise, [this](protocolbuffers/protobuf#26237) PR is required). * At the same time, this may introduce a performance regression for older Protobuf versions. Please measure on your workloads. In extreme cases, disabling the logging middleware or setting `msg-size-log-limit: 0` should help. userver/grpc/benchmarks: ``` BenchCustomLimit 6156 ns 6155 ns 112481 BenchCustomLimitExceptionBased 21486 ns 21485 ns 32497 ``` commit_hash:444433baa658f140354be31611d1a3e8698d623a
* Optimized @ref ugrpc::ToLimitedDebugString and logging middlewares for Protobuf v35+ (to be precise, [this](protocolbuffers/protobuf#26237) PR is required). * At the same time, this may introduce a performance regression for older Protobuf versions. Please measure on your workloads. In extreme cases, disabling the logging middleware or setting `msg-size-log-limit: 0` should help. userver/grpc/benchmarks: ``` BenchCustomLimit 6156 ns 6155 ns 112481 BenchCustomLimitExceptionBased 21486 ns 21485 ns 32497 ``` commit_hash:444433baa658f140354be31611d1a3e8698d623a
The TextFormat::Printer currently continues to iterate over fields and repeated elements even after the underlying ZeroCopyOutputStream returns false. This results in unnecessary CPU usage (reflection and formatting) for large messages.
This change:
Fixes: #23288