Skip to content
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

perf: mesgdef micro optimisation #363

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Conversation

muktihari
Copy link
Owner

  • sync.Pool now use max fields in the entire messages instead of 255. In the current Profilx.xlsx, the maximum fields is 156 (from session message), reducing approx. 99 * unsafe.Sizeof(Field{}) memory usage per created pool object.
  • ToMesg now compare the invalid value of time without converting it to uint32 first. If the value valid, convert the value directly without using datetime.ToUint32 since under the hood it will do comparison.

Benchmark:

goos: darwin
goarch: amd64
pkg: github.com/muktihari/fit/profile/mesgdef
cpu: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
                 old.txt                 new.txt               
                  sec/op       sec/op     vs base                
RecordToMesg-4   214.1n ± 1%   174.6n ± 2%  -18.43% (p=0.000 n=10)

@muktihari muktihari added the performance Changes related to performance improvement label Aug 19, 2024
@muktihari muktihari self-assigned this Aug 19, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (091ed76) to head (9d5b4a4).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #363   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         3663      3662    -1     
=========================================
- Hits          3663      3662    -1     

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

@muktihari muktihari merged commit 523139e into master Aug 19, 2024
4 checks passed
@muktihari muktihari deleted the perf/mesgdef-micro-optimisation branch August 19, 2024 10:48
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