HTML Preparation code:
AخA
 
1
<html>
2
  <head></head>
3
  <body>
4
    var doc = new Document({width: 50, height: 50});
5
  </body> 
6
</html>
Script Preparation code:
 
    var Document = function(Config) {
      this.config = {
        width: "auto",
        height: "auto"
      };
      this.init(Config);
    };
Tests:
  • classic

     
        Document.prototype.init = function(Config) {
          if(typeof Config == "object") {
            for(prop in Config) {
              if(this.config.hasOwnProperty(prop))
                this.config[prop] = Config[prop];
            }
          }
        };
  • new1

     
        Document.prototype.init = function(Config) {
          var keys = Object.keys(Config);
          for(var i = 0; i < keys.length; i++)
            if(this.config.hasOwnProperty(keys[i])) this.config[keys[i]] = Config[keys[i]];
        };
  • new2

     
        Document.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]];
        };
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    classic
    new1
    new2

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36 Edg/80.0.361.69
Chrome 80 on Windows
View result in a separate tab
Test name Executions per second
classic 7705120.0 Ops/sec
new1 7804041.0 Ops/sec
new2 6630885.0 Ops/sec