关于writerbuffer初始化Reserve和Grow的长度
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- performance
Research direction
Start at SerializeImpl and trace how writerbuffer uses Reserve(estimate) and Grow(inc_len), including the constants and length formulas shown in the issue. Measure or inspect the resulting allocations, then document what the values represent and whether the reported memory behavior requires a specific correction.
Written by the indexing model from the issue text.
Description
constexpr size_t kExpectMinifyRatio = 18;
size_t estimate = node_nums * kExpectMinifyRatio + 64;
wb.Reserve(estimate);
inc_len = str_len * 6 + 32 + 3;
wb.Grow(inc_len);
想问一下,SerializeImpl这个函数里,writerbuffer初始化的长度和Grow的长度是以什么作为考量的,代码里的这些数字代表什么含义呢?最近执行代码的时候发现这里的内存分配感觉有些问题,
- Dominant language
- C++
- Stars
- 976
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bytedance/sonic-cpp
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
请问下,下个release版本有规划了吗Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
-
对 parseImpl 进行优化Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
sonic 能在 mac 上测试吗Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
U64toa 单元测试用例不通过Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
All issues in bytedance/sonic-cpp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hyprwm/aquamarine#426 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
amnezia-vpn/amnezia-client#3222 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
valkey-io/valkey-search#1465 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
KhronosGroup/Vulkan-Tutorial#524 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
microsoft/onnxruntime-genai#2633 ·
Maintainers usually reply within 1 day