Closed
Bug 103343
Opened 23 years ago
Closed 23 years ago
Check for IsEmpty before more expensive value check
Categories
(Toolkit :: Form Manager, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: timeless, Unassigned)
References
()
Details
(Keywords: perf)
Attachments
(1 file, 1 obsolete file)
787 bytes,
patch
|
morse
:
review+
|
Details | Diff | Splinter Review |
while popping around the jprof profiling for bug 77073
It seems to me that we can save some time in the not too rare case where there
is no input type.
Comment on attachment 52249 [details] [diff] [review]
reorder IsEmpty before expensive string comparison
()s in wrong place. sorry
Attachment #52249 -
Attachment is obsolete: true
Attachment #52249 -
Flags: needs-work+
Comment 4•23 years ago
|
||
Actually... there is a futher speedup here. How about:
+ (type.IsEmpty() ||
+ (Compare(type, NS_LITERAL_STRING("text"),
+ nsCaseInsensitiveStringComparator()) == 0))) {
That avoids the conversion as well.
Keywords: perf
Comment 5•23 years ago
|
||
r=morse for Zbarsky's modification to patch
cc'ing alecf for sr
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.6
Updated•23 years ago
|
Attachment #52250 -
Flags: review+
Comment 6•23 years ago
|
||
sr=alecf on that second iteration...
fix checked in
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 9•23 years ago
|
||
I think it would've been wiser to determine how often situation A happens, and
how often situation B happens. If A happens more often than B, testing for
situation B before testing for situation A will only slow the A case down, no
matter how much cheaper B is than A.
(A == Compare, B == IsEmpty).
Updated•16 years ago
|
Assignee: timeless → nobody
Product: Core → Toolkit
QA Contact: tpreston → form.manager
Target Milestone: mozilla0.9.6 → ---
Version: Trunk → unspecified
You need to log in
before you can comment on or make changes to this bug.
Description
•