Closed Bug 957593 Opened 12 years ago Closed 12 years ago

txXSLTNumber::isAlphaNumeric should be using lookup tables

Categories

(Core :: XSLT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(2 files, 1 obsolete file)

isAlphaNumeric takes up ~8KB on ARM, ~11KB on x86-64. Let's save a significant amount of space by using lookup tables instead.
Assignee: nobody → nfroyd
Matching a single character is the same as matching an inclusive range of characters where the start and end are the same. This is mostly a mechanical patch so that part 2 is less cluttered.
This patch saves ~5KB on ARM, ~7KB on x86-64. It does make the (common?) ASCII case slower, but we could re-insert explicit checks for the ASCII range if desired. I don't know how many people really care about XSLT performance in Firefox.
Attachment #8357173 - Flags: review?(peterv)
Comment on attachment 8357170 [details] [diff] [review] part 1 - eliminate TX_MATCH_CHAR comment 1 has details.
Attachment #8357170 - Flags: review?(peterv)
Attachment #8357170 - Flags: review?(peterv) → review+
Comment on attachment 8357173 [details] [diff] [review] part 2 - implement txXSLTNumber::isAlphaNumeric with binary search for a codesize win Review of attachment 8357173 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/xslt/src/xslt/txXSLTNumber.cpp @@ +731,5 @@ > + const CharRange* element = std::lower_bound(&alphanumericRanges[0], end, search); > + if (element == end) { > + return false; > + } > + return element->lower >= ch && ch <= element->upper; This seems wrong, it ssems to me it should be: return element->lower <= ch && ch <= element->upper;
Attachment #8357173 - Flags: review?(peterv) → review-
Ah, good catch, that was sloppy translation on my part.
Attachment #8357173 - Attachment is obsolete: true
Attachment #8359398 - Flags: review?(peterv)
Attachment #8359398 - Flags: review?(peterv) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: