format: allocation regression tests
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- go
- Domain
- performance, testing
Research direction
Start with format/zeroalloc_test.go and inspect the existing equivalence tests for DecodeXRowInto, EncodeXRow with a reused buffer, the DecodeBodyInto paths from #38, and DecodeOpsInto from #44. Extend those tests with exact zero-allocation assertions, keeping them off the -short path if needed; done means the required paths fail when allocations become nonzero.
Written by the indexing model from the issue text.
Description
The zero-allocation property is currently a fact about the code, not a guaranteed one. DecodeXRowInto and EncodeXRow measure 0 allocs/op today; nothing fails if a future change adds one. Given that a whole consumer is about to be built on this property, it should be enforced.
Add testing.AllocsPerRun assertions for the paths that must stay at zero:
DecodeXRowIntoEncodeXRowinto a reused buffer- each
Decode<X>BodyIntofrom #38 DecodeOpsIntofrom #44
Baselines measured at 82bf1df (Apple M4 Pro):
| path | ns/op | B/op | allocs |
|---|---|---|---|
DecodeXRowInto |
60 | 0 | 0 |
EncodeXRow (reused buf) |
15 | 0 | 0 |
+ DecodeDMLBody, clean INSERT |
131 | 144 | 1 |
+ DecodeDMLBody, body with INDEX_ID |
207 | 480 | 3 |
The last two rows are what #38 and #39 are expected to drive to zero; this issue is what keeps them there.
Note format/zeroalloc_test.go already exists but tests equivalence between the allocating and non-allocating forms, not the allocation count itself. This extends it rather than replacing it.
Suggested guard: assert == 0 exactly, not a threshold — a threshold hides the regression that matters. Keep the assertions off the -short path if they prove flaky under -race (allocation counts differ under the race detector).
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
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 tarantool/go-xlog
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
documentation
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
feature
Difficulty 3/5 1-2 days Newbie friendliness 76/100
All issues in tarantool/go-xlog
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100