new + access with prototype vs return object (v5)

Revision 5 of this benchmark created on


Preparation HTML

<script>

function Profile1() {}
Profile1.prototype.id = 1;
Profile1.prototype.title = "Default";
Profile1.prototype.siteList = "";

// Settings for the URL generation
Profile1.prototype.url_protocol = false;
Profile1.prototype.url_subdomain = false;
Profile1.prototype.url_domain = true;
Profile1.prototype.url_path = false;

 // Use this text instead of domain if not null
Profile1.prototype.strUseText = "";

// Settings for the key generation
Profile1.prototype.hashAlgorithm = "md5";
Profile1.prototype.username = "";
Profile1.prototype.modifier = "";
Profile1.prototype.passwordLength = 8;
Profile1.prototype.selectedCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./";
Profile1.prototype.passwordPrefix = "";
Profile1.prototype.passwordSuffix = "";
Profile1.prototype.whereToUseL33t = "off";
Profile1.prototype.l33tLevel = 0;

function Profile2() {}
Profile2.prototype = {
    id: 1,
    title: "Default",
    siteList: "",

    // Settings for the URL generation
    url_protocol: false,
    url_subdomain: false,
    url_domain: true,
    url_path: false,

    // Use this text instead of domain if not null
    strUseText: "",

    // Settings for the key generation
    hashAlgorithm: "md5",
    username: "",
    modifier: "",
    passwordLength: 8,
    selectedCharset: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
    passwordPrefix: "",
    passwordSuffix: "",
    whereToUseL33t: "off",
    l33tLevel: 0
};

function Profile3() {
    this.id = 1;
    this.title = "Default";
    this.siteList = "";

    // Settings for the URL generation
    this.url_protocol = false;
    this.url_subdomain = false;
    this.url_domain = true;
    this.url_path = false;

    // Use this text instead of domain if not null
    this.strUseText = "";

    // Settings for the key generation
    this.hashAlgorithm = "md5";
    this.username = "";
    this.modifier = "";
    this.passwordLength = 8;
    this.selectedCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./";
    this.passwordPrefix = "";
    this.passwordSuffix = "";
    this.whereToUseL33t = "off";
    this.l33tLevel = 0;
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
separate prototype declarations
var test1 = new Profile1();
var tmp = test1.title + test1.hashAlgorithm;
ready
combined prototype declarations
var test1 = new Profile2();
var tmp = test1.title + test1.hashAlgorithm;
ready
with this-assignment
var test1 = new Profile3();
var tmp = test1.title + test1.hashAlgorithm;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.