Closed
Bug 542655
Opened 16 years ago
Closed 16 years ago
String.indexOf and String.lastIndexOf can be optimized
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tamarin Graveyard
Virtual Machine
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: stejohns, Unassigned)
Details
Attachments
(1 file)
|
2.24 KB,
patch
|
edwsmith
:
review+
|
Details | Diff | Splinter Review |
Enclosed patch generates substantially better code for VC2008 (but roughly similar code for gcc 4.x). On Windows this moves the needle substantiall for benchmarks of these two methods (moving from slower-than-FP10 to faster-than-FP10).
Basically, cache pattern[0] and preflight the pattern-matching before proceeding.
| Reporter | ||
Updated•16 years ago
|
Attachment #423874 -
Attachment is patch: true
Attachment #423874 -
Attachment mime type: application/octet-stream → text/plain
Attachment #423874 -
Flags: review?(edwsmith)
Comment 1•16 years ago
|
||
Comment on attachment 423874 [details] [diff] [review]
Patch
Looks fine as long as we don't crash when patlen <= 0 by reading pat[0] before we checking the loop condition (j < patlen)
Attachment #423874 -
Flags: review?(edwsmith) → review+
| Reporter | ||
Comment 2•16 years ago
|
||
patlen<=0 should be filtered out by the caller in all cases, but I'll doublecheck and add assertions to that effect
| Reporter | ||
Comment 3•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•