[webkit-reviews] review denied: [Bug 107238] Web Inspector: speedup highlight regex API in DefaultTextEditor : [Attachment 183431] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 21 03:24:24 PST 2013


Pavel Feldman <pfeldman at chromium.org> has denied Andrey Lushnikov
<lushnikov at chromium.org>'s request for review:
Bug 107238: Web Inspector: speedup highlight regex API in DefaultTextEditor
https://bugs.webkit.org/show_bug.cgi?id=107238

Attachment 183431: Patch
https://bugs.webkit.org/attachment.cgi?id=183431&action=review

------- Additional Comments from Pavel Feldman <pfeldman at chromium.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=183431&action=review


> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1896
>	   for (var i = 0; i < lineChunks.length; ++i) {

This nesting iteration looks ugly. You iterate over ranges and then over lines
within ranges and you need to do this both in _measureOverlayHighlight and
below. You also measure overlayHighlight for lines that will get scheduled.
I.e. you will re-measure overlayHighlight for them again later.

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1935
> +	   for(var key in this._highlightRegexs) {

What is key? Is it a regexString?

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1936
> +	       var value = this._highlightRegexs[key];

What is value? Is it a highlightDescriptor? Naming variables key and value when
interacting with a map it not helping.

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1940
> +	   return overlayHighlight;

It seems suboptimal that you build an array of maps. I'd use multimap instead
(i.e. map from line to array of highlights).

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1953
> +	   for (var i = 0; i < lineChunks.length; ++i) {

Here it is, same non-trivial nested again. I would be simpler to collect
lineRows first in one place and pass them here.

> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3062
> +WebInspector.TextEditorMainPanel.LineOverlayHighlightMetrics;

The fact that you need to define top-level structures like this means that you
could have extracted this logic into a separate class. Declaring an array of
elements of a type under a name that does not resemble the  name of the items
is confusing. How am I supposed to know that LineOverlayHighlightMetrics is an
array of ElementMetrics? It should be ElementMetricsArray I guess. And then it
just does not need a name.


More information about the webkit-reviews mailing list