Sha256: b8e9070b5b947c7337be199f20d1ebf35f9cb1adef04991a4c39d46b6fa8fe76

Contents?: true

Size: 903 Bytes

Versions: 11

Compression:

Stored size: 903 Bytes

Contents

function shuffle(a) {
  for (var i = a.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [a[i], a[j]] = [a[j], a[i]];
  }
  return a;
}

var divs = document.querySelectorAll('div');
divs = Array.prototype.slice.call(divs)
divs = shuffle(divs)


performance.mark('array-start')

collection = []
for (var i = 0; i < divs.length; i++) {
  collection.push(divs[i])
}

performance.mark('array-end')


performance.mark('jquery-start')

$collection = $([])
for (var i = 0; i < divs.length; i++) {
  $collection = $collection.add(divs[i])
}

performance.mark('jquery-end')


performance.measure('array', 'array-start', 'array-end')
performance.measure('jquery', 'jquery-start', 'jquery-end')

console.log(up.util.last(performance.getEntriesByName('array')))
console.log(up.util.last(performance.getEntriesByName('jquery')))

performance.clearMarks();
performance.clearMeasures();

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 design/measure_jquery/element_list.js
unpoly-rails-1.0.1 design/measure_jquery/element_list.js
unpoly-rails-1.0.0 design/measure_jquery/element_list.js
unpoly-rails-0.62.1 design/measure_jquery/element_list.js
unpoly-rails-0.62.0 design/measure_jquery/element_list.js
unpoly-rails-0.61.1 design/measure_jquery/element_list.js
unpoly-rails-0.61.0 design/measure_jquery/element_list.js
unpoly-rails-0.60.3 design/measure_jquery/element_list.js
unpoly-rails-0.60.2 design/measure_jquery/element_list.js
unpoly-rails-0.60.1 design/measure_jquery/element_list.js
unpoly-rails-0.60.0 design/measure_jquery/element_list.js