File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -787,3 +787,28 @@ func BenchmarkHashimotoFullSmall(b *testing.B) {
787787 hashimotoFull (dataset , hash , 0 )
788788 }
789789}
790+
791+ func benchmarkHashimotoFullMmap (b * testing.B , name string , lock bool ) {
792+ b .Run (name , func (b * testing.B ) {
793+ tmpdir , err := ioutil .TempDir ("" , "ethash-test" )
794+ if err != nil {
795+ b .Fatal (err )
796+ }
797+ defer os .RemoveAll (tmpdir )
798+
799+ d := & dataset {epoch : 0 }
800+ d .generate (tmpdir , 1 , lock , false )
801+ var hash [common .HashLength ]byte
802+ b .ResetTimer ()
803+ for i := 0 ; i < b .N ; i ++ {
804+ binary .PutVarint (hash [:], int64 (i ))
805+ hashimotoFull (d .dataset , hash [:], 0 )
806+ }
807+ })
808+ }
809+
810+ // Benchmarks the full verification performance for mmap
811+ func BenchmarkHashimotoFullMmap (b * testing.B ) {
812+ benchmarkHashimotoFullMmap (b , "WithLock" , true )
813+ benchmarkHashimotoFullMmap (b , "WithoutLock" , false )
814+ }
You can’t perform that action at this time.
0 commit comments