Skip to content

perf: optimize pointer bytes on mesgdef#620

Merged
muktihari merged 2 commits intomasterfrom
perf/optimize-pointer-bytes-on-mesgdef
Apr 15, 2026
Merged

perf: optimize pointer bytes on mesgdef#620
muktihari merged 2 commits intomasterfrom
perf/optimize-pointer-bytes-on-mesgdef

Conversation

@muktihari
Copy link
Copy Markdown
Owner

This PR will place any pointer bytes: slice, string and array of string at the beginning of the mesgdef's structs to reduce GC workload for scanning its pointers.

Ref: https://cs.opensource.google/go/x/tools/+/refs/tags/v0.44.0:go/analysis/passes/fieldalignment/fieldalignment.go;l=30-44

Pointer bytes is how many bytes of the
object that the garbage collector has to potentially scan for pointers, for example:

	struct { uint32; string }

have 16 pointer bytes because the garbage collector has to scan up through the string's
inner pointer.

	struct { string; *uint32 }

has 24 pointer bytes because it has to scan further through the *uint32.

	struct { string; uint32 }

has 8 because it can stop immediately after the string pointer.

@muktihari muktihari added this to the Unplanned milestone Apr 15, 2026
@muktihari muktihari self-assigned this Apr 15, 2026
@muktihari muktihari added the performance Changes related to performance improvement label Apr 15, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (989716d) to head (65d8b55).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #620   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           43        43           
  Lines         3771      3771           
=========================================
  Hits          3771      3771           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@muktihari muktihari merged commit b1f36d6 into master Apr 15, 2026
6 checks passed
@muktihari muktihari deleted the perf/optimize-pointer-bytes-on-mesgdef branch April 15, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Changes related to performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants