Closed Bug 463330 Opened 16 years ago Closed 14 years ago

translatePhoneNumbers is slower than it should be

Categories

(Firefox for Android Graveyard :: General, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: pavlov, Unassigned)

References

Details

As part of 463291, we made translatePhoneNumbers way faster (4 seconds down to 100ms), but 100ms is still too long for this.  We should optimize it further.
First of all you can easily do this incrementally if you store the returned list of nodes.

However we can use something like:

let textnodes = doc.evaluate('//text()[contains(translate(., "0123456789", "^^^^^^^^^^"), "^^^^") and regexp:test(., "\+?1? ?-?\(?\d{3}\)?[ +-\.]\d{3}[ +-\.]\d{4}")]',
                             doc,
                             function(pre) { return pre == "regexp" && "http://exslt.org/regular-expressions" },
                             XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
                             null);


but that requires that we enable exslt functions to DOM-XPath. The downside with this approach is that we can't incrementally run the regexps, though we can still incrementally do the replacing if we so desire.
we removed this feature a while ago. E10S would make it less of a responsiveness problem too, if we added it back
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.