-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Allow Hash object reuse #45031
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This was discussed before at #25857 but with #25857 (comment) it seems there was an assumption that people don't need to hash a lot of small strings. There were worries about what the UX of allowing resets of this object but there seems to be several APIs in node that have a reset function now. |
Have you actually determined that |
It’s not a bottle neck but it’s showing up enough on cpu-prof profiles
that it’d be great to remove it.
I’m doing some profiling/writing benchmarks and this came up as a possible
win
…On Sun, Oct 16, 2022 at 3:25 PM mscdex ***@***.***> wrote:
Have you actually determined that createHash() is bottlenecking your
application?
—
Reply to this email directly, view it on GitHub
<#45031 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQGASGL4TFNDHV7AGO35FLWDRJDRANCNFSM6AAAAAARGOYMLI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I'm happy to try and contribute this myself if people are ok with the idea of adding this function |
I think a The lack of orthogonality w.r.t. |
IMHO an approach such as #42233 would be better assuming that this is about hashing small amounts of data. |
What is the problem this feature will solve?
#25857 (comment)
I'm creating the hash of many small objects and need to keep track of these individual hashes so #29903 doesn't work.
My specific use case is that I'm hashing directory layouts to setup a file layout that's optimal about symlinking entire directories when its filled with symlinked entries that all point to the same source directory. I can get into specifics if that matters.
What is the feature you are proposing to solve the problem?
crypto.Hash.reset() - reset the internal state of the hasher and allows it to be reused with any new allocations
What alternatives have you considered?
-not use crypto.hash in this case and write my own hasher
-create a native add on that lets me manage to hash context according to my needs
The text was updated successfully, but these errors were encountered: