Streaming XML decoder can reduce heap memory up to 30% #23429
Labels
Azure.Core
CodeGen
Issues that relate to code generation
pillar-performance
The issue is related to performance, one of our core engineering pillars.
Current pipeline and codegen will read the response body in the pipeline so that if reading the body fails the operation will be retried. The cached body is then passed to
xml.Unmarshal
.It was noticed that skipping body download in the pipeline and swapping out
runtime.UnmarshalAsXML
forxml.NewDecoder(resp.Body).Decode(&result.ListBlobsFlatSegmentResponse)
reduced heap memory consumption by ~30%. Unclear if the same gains would be observed for JSON payloads but should be measured.I believe we still want the decoding to happen in the pipeline so that if reading the body fails we can retry the request. This would likely require some new APIs in
azcore
and slight refactoring of codegen such that the*HandleResponse
methods perform the decoding as part of the pipeline.The text was updated successfully, but these errors were encountered: