Skip to content

v0.4.6

Compare
Choose a tag to compare
@dingxin-tech dingxin-tech released this 06 Mar 05:33
· 4 commits to master since this release

Changelog

We have optimized the logic for writing varint, fixed32, fixed64, and bytes methods when using protobuf in tunnel upload. This brings significant performance improvements when writing MaxCompute String, Char, Varchar, Binary, and other data types. Below are the comparison results:

Test Case Old Impl (ns/op) New Impl (ns/op) Time Improvement Old Memory (B/op) New Memory (B/op) Memory Optimization Old Allocs New Allocs Alloc Reduction
Varint_Small 35.89 17.01 52.6% 49 8 83.7% 2 1 50.0%
Varint_Medium 47.11 16.82 64.3% 64 8 87.5% 3 1 66.7%
Varint_Large 50.74 19.98 60.6% 64 8 87.5% 3 1 66.7%
Fixed32 32.83 15.68 52.2% 52 8 84.6% 2 1 50.0%
Fixed64 33.30 16.50 50.4% 56 8 85.7% 2 1 50.0%
WriteBytes_Small 65.82 28.72 56.4% 104 16 84.6% 4 2 50.0%

Key Metrics Explanation:

  1. Time Improvement = (Old Time - New Time)/Old Time × 100%
  2. Memory Optimization = (Old Memory - New Memory)/Old Memory × 100%
  3. Alloc Reduction = (Old Allocations - New Allocations)/Old Allocations × 100%

Performance Highlights:

  • Time Efficiency: All operations show 50-64% latency reduction, with Varint_Medium achieving the most significant improvement (64.3%)
  • Memory Optimization: Memory usage reduced by 83.7-87.5%, with WriteBytes_Small saving 84.6% memory
  • Allocation Reduction: All operations cut allocation counts by 50-66.7%, completely eliminating extra allocations from bytes.Reader

Note: Tests conducted on Apple M2 chip with Go 1.20+