BackburnerJS / backburner.js

A rewrite of the Ember.js run loop as a generic microlibrary
MIT License
392 stars 80 forks source link

use consistent argument parser #314

Closed bekzod closed 6 years ago

bekzod commented 6 years ago
bekzod commented 6 years ago

Benchmark Results:

BEFORE:

 Cancel - no timer .............................................................. 517,581,243.27 op/s
  Debounce & Cancel - function ..................................................... 1,289,046.93 op/s
  Debounce & Cancel - function, target ............................................. 1,301,786.83 op/s
  Later & Cancel - function .......................................................... 308,619.27 op/s
  Later & Cancel - function, target .................................................. 301,310.89 op/s
  Schedule & Cancel - function ..................................................... 3,900,332.93 op/s
  Schedule & Cancel - target, function ............................................. 1,752,119.60 op/s
  Schedule & Cancel - target, string method name ................................... 1,797,325.83 op/s
  Schedule & Cancel - target, string method name, 1 argument ....................... 1,699,961.99 op/s
  Schedule & Cancel - target, string method name, 2 arguments ...................... 1,625,160.63 op/s
  Schedule & Cancel - prescheduled, same queue - target, string method name .......... 978,925.97 op/s
  Schedule & Cancel - prescheduled, separate queue - target, string method name .... 1,698,020.15 op/s
  Throttle & Cancel - function .................................................... 11,009,497.78 op/s
  Throttle & Cancel - function, target ............................................ 10,748,428.83 op/s

AFTER:

  Cancel - no timer .............................................................. 523,623,083.22 op/s
  Debounce & Cancel - function ..................................................... 1,180,616.07 op/s
  Debounce & Cancel - function, target ............................................. 1,186,361.24 op/s
  Later & Cancel - function .......................................................... 303,471.09 op/s
  Later & Cancel - function, target .................................................. 297,463.47 op/s
  Schedule & Cancel - function ..................................................... 3,900,737.32 op/s
  Schedule & Cancel - target, function ............................................. 1,793,731.61 op/s
  Schedule & Cancel - target, string method name ................................... 1,825,686.05 op/s
  Schedule & Cancel - target, string method name, 1 argument ....................... 1,687,422.84 op/s
  Schedule & Cancel - target, string method name, 2 arguments ...................... 1,605,058.81 op/s
  Schedule & Cancel - prescheduled, same queue - target, string method name .......... 997,499.69 op/s
  Schedule & Cancel - prescheduled, separate queue - target, string method name .... 1,753,938.28 op/s
  Throttle & Cancel - function ..................................................... 8,365,828.54 op/s
  Throttle & Cancel - function, target ............................................. 7,986,201.60 op/s

node : v8.9.3

bekzod commented 6 years ago

added tests

bekzod commented 6 years ago

things will look a lot cleaner :) after this 🎊🎊