On 2014/11/21 06:12:49, arv wrote:
https://codereview.chromium.org/745233002/diff/1/src/parser.cc
File src/parser.cc (right):

https://codereview.chromium.org/745233002/diff/1/src/parser.cc#newcode5306
src/parser.cc:5306: Vector<uint8_t> hash_string =
Vector<uint8_t>::New(num_hash_chars);
One thing that seems strange to me is that we have to assemble a large string
to
compute the hash. The hash function just iterates over the characters in that
string.

Conceptually we should be able to compute the hash span by span. Each span is
either a one byte string or a two byte string. We can compute the hash for
these
using a rolling hash.

Looking into the source code here (this is new territory for me too) it looks like we can use a StringHasher and then call AddCharacters on it (which has
one
version for one byte string and one for two byte strings) and then finally get
the hash code out.

Take a look at

https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/objects-inl.h&l=6717
for inspiration.

Making the hashing a bit more memory friendly seems a bit unrelated to this CL
--- I can open a followup that tries to make it easier (but I think it would
result in duplicating some code from ComputeUtf8Hash(), unfortunately).

https://codereview.chromium.org/745233002/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to