spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪

Home Page:https://spacemesh.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node should re-use instances of `hash.Hash` by using a `sync.Pool`

fasmat opened this issue · comments

Description

This issue came up in a discussion here: #5784 (comment)

Every time the node hashes data it re-instantiates hash.Hash objects, which is slow and can be mitigated by using a sync.Pool.

Affected code

An example would be here:


Other places where instances of hash are created should also be checked to be re-used.