Extending settings (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Setup

var objSettings = {
    version: 1
  };
  var objColumn = {
    type: 'text',
    fillHandle: true,
    source: ["A", "B"]
  }
  
    function Settings() {}
  Settings.prototype.version = 1;
  
  function Column0() {}
  Column0.prototype = new Settings();
  Column0.prototype.type = 'text';
  Column0.prototype.fillHandle = true;
  Column0.prototype.source = ["A", "B"];

Teardown



            objSettings.version = 1;
  Settings.prototype.version = 1; //simulate updateSettings()
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Current way
objSettings.version = 2; //simulate updateSettings()
//
var cell = $.extend(true, {}, objSettings, objColumn, {
  fillHandle: false //simulate cells()
});
//
//check if it worked
if (cell.fillHandle !== false) throw new Error('fillHandle');
if (cell.type !== 'text') throw new Error('type');
if (cell.version !== 2) throw new Error('version');
ready
Proposed way
Settings.prototype.version = 2; //simulate updateSettings()
//
var cell = new Column0();
cell.fillHandle = false; //simulate cells()
//
//check if it worked
if (cell.fillHandle !== false) throw new Error('fillHandle');
if (cell.type !== 'text') throw new Error('type');
if (cell.version !== 2) throw new Error('version');
ready

Revisions

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