-
Notifications
You must be signed in to change notification settings - Fork 0
finished first pass on i3-8100B #3
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
base: master
Are you sure you want to change the base?
Conversation
M1 numbers on MBP M1 runs twice as fast as old i3 chip. Mainly because of larger cache? |
for acc := range accChan { | ||
accSum += acc | ||
count += 1 | ||
if count == 4 { |
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.
https://gobyexample.com/range-over-channels fwiw I was doing this break too but then I saw you can close a channel and ranging over a closed channel stops once it's empty
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.
Oh I see. I knew you could could stop when closed, but I didn't think about closing the channel being currently looped over. Thanks!
Before I had a separate go routine wait and close the channel, but I think I set it up wrong and it ended up with some race conditions.
accChan <- (acc0 + acc1) + (acc2 + acc3) | ||
} | ||
|
||
func procAccPayStdDev (i, stop int, payments PaymentsSlice, accChan chan<- float64) { |
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.
Nice work 🔥 , was a fun read
update std dev to calc in one pass: Andrews-Mini:metrics andrewzheng$ go test -bench=. |
new M1 benchmark: goos: darwin |
Andrews-Mini:metrics andrewzheng$ go test -bench=.
goos: darwin
goarch: amd64
pkg: bradfieldcs/csi/systems/mem-hier-2
cpu: Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz
BenchmarkMetrics/Average_age-4 43518 28287 ns/op
BenchmarkMetrics/Average_payment-4 5706 200055 ns/op
BenchmarkMetrics/Payment_stddev-4 2706 423003 ns/op
PASS
ok bradfieldcs/csi/systems/mem-hier-2 5.895s
Considering further unrolling of standard deviation to take advantage of long latency in float division.