Classic property get/set vs. harmony proxy.

JavaScript performance comparison

Revision 6 of this test case created


Profile difference between regular object property accesses and access controlled by a Harmony Proxy. I wanted to see how much slower these proxies are compared to the regular properties.

For Chrome, please activate Harmony proxy support by enabling the option named "Enable Experimental JavaScript" in "chrome://flags/" page.

Preparation code

Benchmark.prototype.setup = function() {
    var _i = 0, _j = 0, _k = 0, _l = 0;
    var A = { value: null };
    var B = {};
    Object.defineProperty(B, "value", {
        value: 0,
        enumerable: true,
        configurable: false,
        writable: true
    function proxify(target) {
        return Proxy.create({
            get: function(receiver, name) {
                return target[name];
            set: function(receiver, name, value) {
                target[name] = value;
                return true;
    var C = proxify({ value: 0 });
    function Closure() {
        var _value = 0;
        Object.defineProperty(this, 'value', {
            enumarable: true,
            get: function() { return _value; },
            set: function(v) { _value = v; }
    var D = new Closure();

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Classic property assignment.
A.value += _i++;
Configured property assignment.
B.value += _j++;
Prototype harmony proxy assignment.
C.value += _k++;
Getter/Setter in Closure.
D.value += _l++;

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment