Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Jul 15, 2020
1 parent 0c2c8af commit e5be175
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 100 deletions.
97 changes: 49 additions & 48 deletions internal/singleflight/singleflight/mutex.csv
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
goroutine,duration,hit_rate10,10µs,0.737646
10,100µs,0.972091
10,200µs,0.977159
10,500µs,0.599423
10,1ms,0.999037
10,5ms,0.977364
10,10ms,0.982399
10,25ms,0.906047
10,50ms,0.997860
10,100ms,1.000000
10,250ms,1.000000
10,500ms,1.000000
100,10µs,0.981974
100,100µs,0.999175
100,200µs,0.999714
100,500µs,0.999192
100,1ms,0.997603
100,5ms,0.999620
100,10ms,0.985004
100,25ms,0.996214
100,50ms,0.999969
100,100ms,0.999929
100,250ms,0.999034
100,500ms,1.000000
1000,10µs,0.974291
1000,100µs,0.999773
1000,200µs,0.998745
1000,500µs,0.999966
1000,1ms,0.016150
1000,5ms,0.017008
1000,10ms,0.999922
1000,25ms,0.999868
1000,50ms,0.257532
1000,100ms,0.996004
1000,250ms,0.999999
1000,500ms,1.000000
10000,10µs,0.970830
10000,100µs,0.955484
10000,200µs,0.998642
10000,500µs,1.000000
10000,1ms,0.624199
10000,5ms,0.999476
10000,10ms,0.999971
10000,25ms,0.983153
10000,50ms,0.998167
10000,100ms,0.999998
10000,250ms,0.999999
10000,500ms,1.000000
goroutine,duration,hit_rate
10,10000,0.709765
10,100000,0.953959
10,200000,0.661456
10,500000,0.881889
10,1000000,0.991779
10,5000000,0.998775
10,10000000,0.999960
10,25000000,0.996246
10,50000000,0.999999
10,100000000,1.000000
10,250000000,1.000000
10,500000000,1.000000
100,10000,0.999401
100,100000,0.998885
100,200000,0.998377
100,500000,0.999230
100,1000000,0.994818
100,5000000,0.554808
100,10000000,0.999983
100,25000000,0.986015
100,50000000,0.999976
100,100000000,0.999997
100,250000000,0.999999
100,500000000,1.000000
1000,10000,0.038118
1000,100000,0.979978
1000,200000,0.964321
1000,500000,0.999918
1000,1000000,0.987485
1000,5000000,0.175480
1000,10000000,0.875239
1000,25000000,0.997557
1000,50000000,0.955092
1000,100000000,0.999995
1000,250000000,0.999999
1000,500000000,1.000000
10000,10000,0.874941
10000,100000,0.379683
10000,200000,0.999939
10000,500000,0.999911
10000,1000000,0.999434
10000,5000000,0.999976
10000,10000000,0.998109
10000,25000000,0.999998
10000,50000000,0.639145
10000,100000000,0.999999
10000,250000000,0.999996
10000,500000000,0.999999
8 changes: 4 additions & 4 deletions internal/singleflight/singleflight/singleflight_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

type Result struct {
Goroutine int `csv:"goroutine"`
Duration time.Duration `csv:"duration"`
Duration int64 `csv:"duration"`
HitRate float64 `csv:"hit_rate"`
}

Expand Down Expand Up @@ -119,7 +119,7 @@ func Benchmark_group_Do_with_mutex_1(b *testing.B) {
)
results = append(results, Result{
Goroutine: i,
Duration: dur,
Duration: dur.Nanoseconds(),
HitRate: hitRate,
})
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func Benchmark_group_Do_with_syncMap(b *testing.B) {
)
results = append(results, Result{
Goroutine: i,
Duration: dur,
Duration: dur.Nanoseconds(),
HitRate: hitRate,
})
}
Expand All @@ -171,7 +171,7 @@ func toCSV(name string, r []Result) error {
return err
}
defer f.Close()
_, err = fmt.Fprint(f, "goroutine,duration,hit_rate")
_, err = fmt.Fprintln(f, "goroutine,duration,hit_rate")
for _, res := range r {
_, err = fmt.Fprintf(f, "%d,%v,%f\n", res.Goroutine, res.Duration, res.HitRate)
if err != nil {
Expand Down
97 changes: 49 additions & 48 deletions internal/singleflight/singleflight/syncmap.csv
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
goroutine,duration,hit_rate10,10µs,0.996371
10,100µs,0.999446
10,200µs,0.999734
10,500µs,0.999756
10,1ms,0.999914
10,5ms,0.999989
10,10ms,0.999993
10,25ms,0.999997
10,50ms,0.999999
10,100ms,0.999999
10,250ms,1.000000
10,500ms,1.000000
100,10µs,0.999941
100,100µs,0.999139
100,200µs,0.999048
100,500µs,0.999557
100,1ms,0.999765
100,5ms,0.999979
100,10ms,0.999988
100,25ms,0.999993
100,50ms,0.999996
100,100ms,0.999998
100,250ms,1.000000
100,500ms,1.000000
1000,10µs,0.999958
1000,100µs,0.999430
1000,200µs,0.999680
1000,500µs,0.999575
1000,1ms,0.999766
1000,5ms,0.999981
1000,10ms,0.999988
1000,25ms,0.999993
1000,50ms,0.999995
1000,100ms,0.999998
1000,250ms,1.000000
1000,500ms,1.000000
10000,10µs,0.996888
10000,100µs,0.998836
10000,200µs,0.999227
10000,500µs,0.999668
10000,1ms,0.999829
10000,5ms,0.999983
10000,10ms,0.999999
10000,25ms,0.999997
10000,50ms,0.999998
10000,100ms,0.999999
10000,250ms,1.000000
10000,500ms,1.000000
goroutine,duration,hit_rate
10,10000,0.990461
10,100000,0.999107
10,200000,0.998239
10,500000,0.999705
10,1000000,0.999727
10,5000000,0.999963
10,10000000,0.999988
10,25000000,0.999993
10,50000000,0.999998
10,100000000,0.999999
10,250000000,1.000000
10,500000000,1.000000
100,10000,0.999772
100,100000,0.996037
100,200000,0.998188
100,500000,0.999945
100,1000000,0.999583
100,5000000,0.999968
100,10000000,0.999983
100,25000000,0.999990
100,50000000,0.999991
100,100000000,0.999995
100,250000000,0.999999
100,500000000,1.000000
1000,10000,0.999648
1000,100000,0.998791
1000,200000,0.998999
1000,500000,0.999627
1000,1000000,0.999592
1000,5000000,0.999968
1000,10000000,0.999970
1000,25000000,0.999983
1000,50000000,0.999990
1000,100000000,0.999992
1000,250000000,0.999998
1000,500000000,0.999999
10000,10000,0.992424
10000,100000,0.999979
10000,200000,0.999998
10000,500000,1.000000
10000,1000000,1.000000
10000,5000000,1.000000
10000,10000000,0.999999
10000,25000000,1.000000
10000,50000000,1.000000
10000,100000000,1.000000
10000,250000000,1.000000
10000,500000000,1.000000

0 comments on commit e5be175

Please sign in to comment.