-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌱 Some more cleanup for field placement #3791
Conversation
- Cleanup for fieldplacement in struct Signed-off-by: naveensrinivasan <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3791 +/- ##
==========================================
+ Coverage 66.61% 70.52% +3.90%
==========================================
Files 230 230
Lines 15622 15622
==========================================
+ Hits 10407 11017 +610
+ Misses 4599 3932 -667
- Partials 616 673 +57 |
// | ||
//nolint:govet | ||
type CheckResult struct { | ||
Name string | ||
Version int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment on human-readability. We should decide if we care about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the time, Scorecard is used by non-humans. So it helps to have performance IMO. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it helps to have performance IMO. Thoughts?
My first thought is, does it matter? I know we have the linter (and could disable it if the answer is no), but is this a performance bottleneck? Compared to the I/O and API operations we need to wait for anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler utilizes the L1 cache based on the word size.
https://articles.wesionary.team/simple-data-alignment-technique-to-speed-up-your-struct-in-golang-954c43faa1fe
https://www.ardanlabs.com/blog/2013/07/understanding-type-in-go.html
It helps to make it better.
I understand API Operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I ask for benchmarks is it's not quite as simple:
golang/go#10014 (comment)
That seems like it is trying to solve a 1970s problem, namely packing structs to use as little space as possible. The 2010s problem is to put related fields near each other to reduce cache misses
type RawResults struct { | ||
BinaryArtifactResults BinaryArtifactData | ||
Metadata MetadataData | ||
BranchProtectionResults BranchProtectionsData | ||
CIIBestPracticesResults CIIBestPracticesData | ||
CITestResults CITestData | ||
CodeReviewResults CodeReviewData | ||
PinningDependenciesResults PinningDependenciesData | ||
SecurityPolicyResults SecurityPolicyData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I know this was alphabetized recently to find the data easier.
#3540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request is stale because it has been open for 10 days with no activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replied to the thread as well. Ultimately it's always a reversible decision, so leaving it up to you.
// | ||
//nolint:govet | ||
type CheckResult struct { | ||
Name string | ||
Version int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I ask for benchmarks is it's not quite as simple:
golang/go#10014 (comment)
That seems like it is trying to solve a 1970s problem, namely packing structs to use as little space as possible. The 2010s problem is to put related fields near each other to reduce cache misses
This pull request has been marked stale because it has been open for 10 days with no activity |
This pull request has been marked stale because it has been open for 10 days with no activity |
This pull request has been marked stale because it has been open for 10 days with no activity |
What kind of change does this PR introduce?
(Is it a bug fix, feature, docs update, something else?)
What is the current behavior?
What is the new behavior (if this is a feature change)?**
Which issue(s) this PR fixes
Special notes for your reviewer
Does this PR introduce a user-facing change?
For user-facing changes, please add a concise, human-readable release note to
the
release-note
(In particular, describe what changes users might need to make in their
application as a result of this pull request.)