Benchmark JS

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.js"></script>
<div id="target" style="width: 0px">
Testing roundtrip
</div>

<div id="log" style="white-space: pre">
</div>

JavaScript

var suite = new Benchmark.Suite;

// add tests
suite.add('string', function() {
  let width = target.style.width;
  target.style.width = (width.slice(0, -2) + 1) + 'px';
})
.add('typed', function() {
  let width = target.attributeStyleMap.get('width');
  width.value++;
  target.attributeStyleMap.set('width', width);
})
// add listeners
.on('cycle', function(event) {
  log.textContent += String(event.target) + '\n';
})
.on('complete', function() {
  log.textContent += 'Fastest is ' + this.filter('fastest').pluck('name');
})
.run();