Skip to content

Commit

Permalink
Force single threaded hashing when there is only 1 CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsutton committed Aug 23, 2024
1 parent 49c3d03 commit d1b3d3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion trie/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package trie

import (
"runtime"
"sync"

"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -45,7 +46,7 @@ var hasherPool = sync.Pool{

func newHasher(parallel bool) *hasher {
h := hasherPool.Get().(*hasher)
h.parallel = parallel
h.parallel = parallel && runtime.NumCPU() > 1
return h
}

Expand Down

0 comments on commit d1b3d3e

Please sign in to comment.