Closed
Bug 171844
Opened 22 years ago
Closed 15 years ago
fix inefficient string match() usage in mailnews (and rest of tree)
Categories
(SeaMonkey :: MailNews: Message Display, defect)
SeaMonkey
MailNews: Message Display
Tracking
(Not tracked)
RESOLVED
EXPIRED
People
(Reporter: sspitzer, Unassigned)
Details
Attachments
(1 file)
633 bytes,
patch
|
Details | Diff | Splinter Review |
brendan writes:
45 var validChars = hostname.match(/[A-Za-z0-9.-]/g);
46 if (!validChars || (validChars.length != hostname.length)) {
47 return true;
48 }
This is a really inefficient way to tell whether a string consists only of
characters from [A-Za-z0-9.-]. The match against a global regexp will
construct an Array with one-char elements, whose length (as the code expects)
will count the number of one-char matches in the target string. Each of those
one-char elements is a separate (dependent, so there's no buffer copying, but
there're still a bunch of little string GC-things) string GC-thing.
It'd be much faster to do something like
var matchResults = hostname.match(/[A-Za-z0-9.-]+);
return (matchResults && matchResults[0] == hostname);
even though I'm the one who original copied and pasted this code (from
somewhere else, I'm sure) assigning to varada who recently moved it.
Reporter | ||
Comment 1•22 years ago
|
||
varada, can you fix this usage and any others in the tree?
OS: Windows 2000 → All
QA Contact: olgam → stephend
Hardware: PC → All
Comment 4•22 years ago
|
||
Yeah, what timeless wrote:
return /^[A-Za-z0-9.-]+$/.test(hostname);
That should be fastest.
/be
Reporter | ||
Comment 6•22 years ago
|
||
taking all of varada's bugs.
Assignee: varada → sspitzer
Status: ASSIGNED → NEW
Updated•20 years ago
|
Product: Browser → Seamonkey
Updated•20 years ago
|
Assignee: sspitzer → mail
Updated•16 years ago
|
Assignee: mail → nobody
QA Contact: stephend → message-display
Comment 7•16 years ago
|
||
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.
If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.
Query tag for this change: mass-UNCONFIRM-20090614
Status: NEW → UNCONFIRMED
Comment 8•16 years ago
|
||
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.
If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.
Query tag for this change: mass-UNCONFIRM-20090614
Comment 9•16 years ago
|
||
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.
If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.
Query tag for this change: mass-UNCONFIRM-20090614
Comment 10•15 years ago
|
||
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but still has no comment since the inception of the SeaMonkey project 5 years ago.
Because of this, we're resolving the bug as EXPIRED.
If you still can reproduce the bug on SeaMonkey 2 or otherwise think it's still valid, please REOPEN it and if it is a platform or toolkit issue, move it to the according component.
Query tag for this change: EXPIRED-20100420
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → EXPIRED
You need to log in
before you can comment on or make changes to this bug.
Description
•