Closed Bug 77586 Opened 23 years ago Closed 14 years ago

nsTextFragment::SetTo() optimizations

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 566942

People

(Reporter: waterson, Unassigned)

Details

(Keywords: perf)

nsTextFramgment::SetTo() may benefit from the following optimizations. (Sorry, 
haven't measured how much time is spent here; cf. bug 77540.)

- we scan the entire string once to determine if we need to use a
  double-byte buffer. (Which sorta means that we're going to end up
  in a worst-case situation, since most web pages are probably 7-bit
  ASCII.)

  - Since we've probably scanned the string two or three times
    by this point, the caller could probably pass this information
    in.

  - Or, if we can't do that, then maybe we could optimisitcally
    allocate a single-byte buffer and start copying, and then
    fault and restart if it ends up being double-byte.

  - Or, pessimistically allocate a double-byte buffer and realloc()
    it to a smaller size if we get lucky and end up with a single-byte
    string?

- Why do we need our own implementation of memcpy() in SetTo()? Why
  not use the one provided with the standard library, as it's likely to
  be hand-optimized.
Keywords: perf
Target Milestone: --- → mozilla1.0
I think time spend in SetTo is minor, like 0.05sec out ot 120sec for long pages.
Measured with sun's gprof
QA Contact: lchiang → stummala
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Depends on: 116651
No longer depends on: 116651
Priority: -- → P3
Target Milestone: mozilla1.0.1 → ---
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Assignee: general → nobody
QA Contact: stummala → general
Status: NEW → RESOLVED
Closed: 14 years ago
Component: DOM: Abstract Schemas → DOM
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.