Test name | Executions per second |
---|---|
doc1 | 440683.2 Ops/sec |
doc2 | 1688912.2 Ops/sec |
var Document = function(Config) {
this.config = {
worker: true,
width: "auto",
height: "auto",
format: "default",
quality: "default"
};
this.init(Config);
};
Document.prototype.init = function(Config) {
if(typeof Config == "object") {
for(prop in Config) {
if(this.config.hasOwnProperty(prop))
this.config[prop] = Config[prop];
}
}
};
var Document2 = function(Config) {
this.config = {
worker: true,
width: "auto",
height: "auto",
format: "default",
quality: "default"
};
this.init(Config);
};
Document2.prototype.init = function(Config) {
var keys = Object.keys(Config);
for(var i = 0; i < keys.length; i++)
if(this.config[keys[i]]) this.config[keys[i]] = Config[keys[i]];
};
var preview = new Document({width: 50, height: 50});
var preview = new Document2({width: 50, height: 50});