1.0.0 • Published 4 years ago

timit v1.0.0

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

Measure your javascript function execution time. Both browser and node are supported. node

install

npm install 'timit'

example

import timit from '.src/timit'

//timti(fn1[, fn2, ..., fnN][, argsList][, repeat][, numbers])

timit(function foo(){})

timit(function foo() {}, function bar() {}, 5, 10000)

timit(
    [
        function foo() {},
        function bar() {}, 
    ],
    ['args1', 'args2', 'args3']
)

const tim = new timit({
    funcs: [
        function foo() {},
        function bar() {}, 
    ],
    argsList: [
        ['1stArg: 1', '2ndArg: 100'],
        ['1stArg: 2', '2ndArg: 200']
    ],
    repeat: 3,
    numbers: 1,
    digits: 3
})

tim.time()

tim.time({repeat: 10})

The result is printed in the console.

options

otpiontypedefaultremark
funcsFunction-function to test
argsListArray-parameter sequence
repeatNumber5number of tests
numbersNumber1Code snippets that take very little time, run multiple times to zoom in
digitsNumber3display accuracy
outputFunctionlogcustom output

digits and output only support passing parameters through object.