Closed gsalgado closed 6 years ago
I'm pretty sure this is because PreImage
is implemented using a list to keep track of all values passed to .update()
and then joins those values in a bytes object and passes it to the underlying hasher function in its .digest()
method. If its .update()
method just passed the value to the backend, I imagine the performance would be comparable
Yeah, the current implementation was hacky at best. I think that this functionality just needs to be moved down into the backend like you said rather than caching these values locally like is currently being done.
PreImage.digest()
takes significantly longer after every.update()
call, whereas the time for the same operation on a rawpysha3.keccak_256
instance remains constant. Here's a hackish test comparing both