Closed holiman closed 6 months ago
Can you comment on the difference this makes in geth?
I've made some changes and left some comments -- can merge once you look over them -- linter itself seems to be failing which is orthogonal to this PR (I ran it locally)
can merge once you look over them
Looks good to me!
This PR does a couple of things.
First of all, it changes the public interface methods that currently pass
Blob
by value, to instead pass*Blob
, that is , by reference.NOTE: This means that this PR creates a breaking change, which requires a major version-upgrade of this library, strictly speaking. :warning:
The
Blob
type is anarray
, of 130K bytes. As opposed to a slice of similar size, when an array is passed by value, every byte is passed over the heap.Secondly, this PR pushes this change a bit further into the library, and also spot-fixes some places where memory usage can be reduced.
This PR on it's own doesn't really make a lot of difference. However, when an external user, e.g. geth, calls this library, the heap-copying might make more of a difference, since inlining cannot be performed.
Anyway, these are the differences I get with the existing benchmarks.