Bug 34921

Summary: Web Inspector: cache created row, span and text elements in TextView to improve scroller performance on debug build.
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web Inspector (Deprecated)Assignee: Pavel Feldman <pfeldman>
Status: RESOLVED FIXED    
Severity: Normal CC: bweinstein, joepeck, rik, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed change. timothy: review+

Description Pavel Feldman 2010-02-13 07:29:32 PST
Release mode is fast both with and without this change. I noticed that our styles are taking too long to recalc though (due to selector complexity?)
Comment 1 Pavel Feldman 2010-02-13 07:36:51 PST
Created attachment 48704 [details]
[PATCH] Proposed change.
Comment 2 Timothy Hatcher 2010-02-13 07:57:06 PST
Comment on attachment 48704 [details]
[PATCH] Proposed change.


> +            var span = this._cachedSpans[this._cachedSpans.length - 1];
> +            this._cachedSpans.length--;

I am surprised this works! You should just use the pop() function. This is done in a few other places.


I also don't understand how this helps much, since you just cache te elements, but the contents are replaces every time.

r+ if you change to use pop() before landing.
Comment 3 Pavel Feldman 2010-02-14 01:21:12 PST
(In reply to comment #2)
> (From update of attachment 48704 [details])
> 
> > +            var span = this._cachedSpans[this._cachedSpans.length - 1];
> > +            this._cachedSpans.length--;
> 
> I am surprised this works! You should just use the pop() function. This is done
> in a few other places.
> 
> 
> I also don't understand how this helps much, since you just cache te elements,
> but the contents are replaces every time.

Scrolling a large document slowly needs thousands of spans to be created at runtime for the highlight, thousands of rows to be created for lines. Native elements are allocated in heap, js wrappers are created for all of them since they are used in our code. Caching allows to limit number of created spans to a couple of hundreds.

> 
> r+ if you change to use pop() before landing.

Done.


Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/inspector/front-end/SourceFrame.js
	M	WebCore/inspector/front-end/TextViewer.js
Committed r54756