Closed Bug 504033 Opened 10 years ago Closed 10 years ago

avoiding calling JSFinalizeStub.

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #503461 comment 4 +++

When finalizing the objects we are always calling the finalization hook:

static void
js_FinalizeObject(JSContext *cx, JSObject *obj)
{
...
    /* Finalize obj first, in case it needs map and slots. */
    STOBJ_GET_CLASS(obj)->finalize(cx, obj);

For the default objects and arrays the finalization hook is the empty JSFinalizeStub method. We should investigate if avoiding this call via simple check for the sub method can speedup things.
Attached patch v1Splinter Review
The patch allows to use null in place of JSFinalizeStub. This speed ups the GC phase of the following test case by about 1%:

function test()
{
    var array = [];
    for (var j = 0; j != 12; ++j) {
        var array2 = [];
        for (var i = 0; i != 1e5; ++i) {
            array2.push({});
        }
        array.push(array2);
    }
    return array;
}

test();
var t = Date.now();
gc();
print(Date.now() - t);
Attachment #389489 - Flags: review?(brendan)
Attachment #389489 - Flags: review?(brendan) → review+
http://hg.mozilla.org/tracemonkey/rev/f79e027c3fb1
Flags: wanted1.9.2?
Whiteboard: fixed-in-tracemonkey
Flags: wanted1.9.2? → wanted1.9.2+
http://hg.mozilla.org/mozilla-central/rev/f79e027c3fb1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.