A lot faster since the low byte can be 0 and faster to search highest value
byte

But that depends on the input, right? For maximum speed you want to search for
the most *unique* byte in the string, but you can't determine that without
analyzing the string first. It's easy to construct examples where either of the strategies "low byte", "lower-value byte", "high byte", "higher-value byte" gets
pathologically unlucky. Example: "higher-value byte" will be slow here:
subject: 0xFF01, 0xFF02, 0xFF03, ..., 0xFFFE, 0x12FF
pattern: 0x12FF

So in the absence of any data about typical distributions of byte values of
two-byte strings, I would have gone for the simpler code.

LGTM anyway.

https://codereview.chromium.org/1324803003/

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to