Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Issue 7114: * Changed string search to full-blown Boyer-Moore. (Closed)

Created:
12 years, 2 months ago by Lasse Reichstein
Modified:
9 years, 6 months ago
Reviewers:
Erik Corry
CC:
v8-dev
Visibility:
Public.

Description

Most operations are faster than before.

Patch Set 1 #

Patch Set 2 : Addressed review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+259 lines, -118 lines) Patch
M src/runtime.cc View 1 3 chunks +152 lines, -118 lines 0 comments Download
M test/mjsunit/string-indexof.js View 2 chunks +107 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Lasse Reichstein
Please review the changes. Also let's consider whether our benchmarks are adequate. A lot of ...
12 years, 2 months ago (2008-10-13 14:06:43 UTC) #1
Erik Corry
LGTM http://codereview.chromium.org/7114/diff/1/2 File src/runtime.cc (right): http://codereview.chromium.org/7114/diff/1/2#newcode959 Line 959: static const int kMaxAsciiChar = 0x7f; Please ...
12 years, 2 months ago (2008-10-14 08:12:14 UTC) #2
Lasse Reichstein
12 years, 2 months ago (2008-10-14 09:21:03 UTC) #3
http://codereview.chromium.org/7114/diff/1/2
File src/runtime.cc (right):

http://codereview.chromium.org/7114/diff/1/2#newcode959
Line 959: static const int kMaxAsciiChar = 0x7f;
On 2008/10/14 08:12:14, Erik Corry wrote:
> Please use String::kMaxAsciiChar

Done.
I did use it, just forgot to remove the old constant.

http://codereview.chromium.org/7114/diff/1/2#newcode962
Line 962: // shift. Only allow the last kBMMaxShift characters of the needle
On 2008/10/14 08:12:14, Erik Corry wrote:
> allow -> allows

Done.

http://codereview.chromium.org/7114/diff/1/2#newcode964
Line 964: class BMGoodSuffixBuffers {
On 2008/10/14 08:12:14, Erik Corry wrote:
> Should inherit from AllStatic

Done.

http://codereview.chromium.org/7114/diff/1/2#newcode965
Line 965: private:
On 2008/10/14 08:12:14, Erik Corry wrote:
> Style guide dictates public before private.

Done.

http://codereview.chromium.org/7114/diff/1/2#newcode972
Line 972: void init(int needle_length) {
On 2008/10/14 08:12:14, Erik Corry wrote:
> should be inline

Done.

http://codereview.chromium.org/7114/diff/1/2#newcode1028
Line 1028: // End of Bad Char computation
On 2008/10/14 08:12:14, Erik Corry wrote:
> Terminate comments with '.'

Done.

http://codereview.chromium.org/7114/diff/1/2#newcode1084
Line 1084: // we have matched more than our tables allow us to be smart about.
On 2008/10/14 08:12:14, Erik Corry wrote:
> It seems like here we could still use the bad char table?

Not currently, but we only index the last kBMMaxShift characters of the pattern.
At the time of failure, all recorded occurences are after the failing character,
and will cause a negative shift.
If we indexed the entire pattern, we might still be able to use bad-char shifts
on characters with a last occurence not in the last 256 chars.

http://codereview.chromium.org/7114/diff/1/2#newcode1121
Line 1121: while (pattern[j] == subject[j+i]) {
On 2008/10/14 08:12:14, Erik Corry wrote:
> This reads one too far in pattern and subject, no?

No, we know that the pattern is at least two chars long.
I'll add an ASSERT instead of just the comment.

Powered by Google App Engine
This is Rietveld 408576698