Closed Bug 68030 Opened 24 years ago Closed 23 years ago

StyleContextCache::AddContext is too expensive

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 72217

People

(Reporter: bratell, Assigned: pierre)

References

()

Details

(Keywords: perf)

While analyzing the color table stresscase, see bug 67692, I notices that 
StyleContextCache::AddContext took a bit more time than I think is necessary. 

It stands for 7.6% of the total time for the page load distributed on:
69.6%  nsVoidArray::IndexOf(...)
18.8%  VerifyList(...)
11.0%  InsertElementAt(...) (I think that is what AppendElement expands to)
 0.5%  GetList
 0.1%  The function itself.

What I feels could be optimized is the IndexOf call that probably traverses the 
whole list before failing every time for this testcase. I assume that it is 
necessary for other cases, but we could probably do better than a linear search 
through the array. 

Also, VerifyList is always succeeding and for this special case, could be 
removed. Is it necessary in a release build?
Keywords: perf
nsVoidArray::IndexOf(aContext) being something else than -1 would cause an 
assertion. Couldn't we leave it with the assertion, and remove the call? It is a 
5% gain for this testcase.

The VerifyList call must be there though. I was tricked by the function name, 
but I know see that it's necessary.
Blocks: 67692
So, this bug was "redetected" a month later and is now fixed by attinasi as bug
72217. I'm marking this a dupe of bug 72217.

*** This bug has been marked as a duplicate of 72217 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.