andrew--r / puretabs

Простые табы на чистом JavaScript.
http://andrew--r.github.io/puretabs
41 stars 3 forks source link

Helpers bench #1

Open osiyuk opened 9 years ago

osiyuk commented 9 years ago

Can you write a benchmark page, that makes 12.500 classes, plain DOM of 10.000 elements with random classes, makes 1.000.000 addClass operations, 700.000 removeClass operations, 1.500.000 containClass operations?

The result is small table:

operation name amount of operations total time spent average median
addClass 1.000.000 ? ? ?

Details:

function bench_wrapper(/* array */ result, func) {
  return wrapper() {
    var res, time;
    time = new Date();
    res = func.apply(this, arguments);
    time = new Date - time; /* milliseconds */
    result.push(time);
    return res;
  }
}
osiyuk commented 9 years ago

@andrew--r Hi