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

feat: add Scaled() method for scaled fields in mesgdef and reduce sec/op on ToMesg #93

Merged
merged 4 commits into from
Jan 4, 2024

Conversation

muktihari
Copy link
Owner

  • Reduce float32 and float64 invalid value creation, instead define as read-only global variable.
  • Add method Scaled() for fields that can be scaled in mesgdef
  • Reduce type conversion overhead by directly casting the type without using typeconv in ToMesg() method.
    benchstat:
goos: darwin
goarch: amd64
pkg: github.com/muktihari/fit/profile/mesgdef
cpu: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
                recordmesg_old.txt           recordmesg_new.txt          
                      sec/op           sec/op     vs base                
RecordToMesg-4          195.9n ± 7%   144.9n ± 32%  -26.01% (p=0.001 n=10)

                recordmesg_old.txt        recordmesg_new.txt       
                       B/op            B/op     vs base            
RecordToMesg-4           8.000 ± 0%   8.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

                recordmesg_old.txt        recordmesg_new.txt       
                    allocs/op       allocs/op   vs base            
RecordToMesg-4           2.000 ± 0%   2.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

@muktihari muktihari added the enhancement New feature or request label Jan 4, 2024
@muktihari muktihari self-assigned this Jan 4, 2024
@muktihari muktihari merged commit 77b3475 into master Jan 4, 2024
1 check passed
@muktihari muktihari deleted the feat/mesgdef-scaled-value branch January 4, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant