Bug 91531 - Web Inspector: intern strings when processing timeline records
Summary: Web Inspector: intern strings when processing timeline records
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Kosyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-17 12:01 PDT by Andrey Kosyakov
Modified: 2012-07-18 06:46 PDT (History)
10 users (show)

See Also:


Attachments
Patch (3.40 KB, patch)
2012-07-17 12:13 PDT, Andrey Kosyakov
no flags Details | Formatted Diff | Diff
Patch (4.55 KB, patch)
2012-07-18 06:09 PDT, Andrey Kosyakov
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Kosyakov 2012-07-17 12:01:46 PDT
This adds StringPool class and uses it to intern all strings occurring in Timeline records. This cuts heap size from 117M to 50M when processing a 97M timeline log.
Comment 1 Andrey Kosyakov 2012-07-17 12:13:52 PDT
Created attachment 152803 [details]
Patch
Comment 2 Pavel Feldman 2012-07-17 13:05:28 PDT
Comment on attachment 152803 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=152803&action=review

> Source/WebCore/inspector/front-end/utilities.js:729
> +    deepIntern: function(obj)

internObject?

> Source/WebCore/inspector/front-end/utilities.js:737
> +                this.deepIntern(obj[field]);

Do you want to introduce a re-entrance guard here to say support up to 100 levels? Stack overflow is sometimes hard to debug.
Comment 3 Andrey Adaikin 2012-07-18 00:29:39 PDT
Comment on attachment 152803 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=152803&action=review

> Source/WebCore/inspector/front-end/utilities.js:711
> +    intern: function(string)

what if string is equal to "__proto__" or "constructor" or "toString" or etc. ?
maybe add (this._strings.__proto__ = null) to the constructor and reset() methods?

>> Source/WebCore/inspector/front-end/utilities.js:729
>> +    deepIntern: function(obj)
> 
> internObject?

a test case: 

var obj = {};
obj.foo = obj;
pool.deepIntern(obj);
Comment 4 Andrey Kosyakov 2012-07-18 06:09:18 PDT
Created attachment 153002 [details]
Patch
Comment 5 Pavel Feldman 2012-07-18 06:23:58 PDT
Comment on attachment 153002 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=153002&action=review

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:635
> +        if (!this._details)

Is this a part of a different change?

> Source/WebCore/inspector/front-end/utilities.js:729
> +        if (string === "__proto__")

What does this mean?

> Source/WebCore/inspector/front-end/utilities.js:741
> +        this._strings = { __proto__: null };

Object.create(null)
Comment 6 Andrey Kosyakov 2012-07-18 06:46:43 PDT
Committed r122964: <http://trac.webkit.org/changeset/122964>