# timit

> Measure JavaScript function execution time

Latest version **1.0.0** (published 2021-01-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install timit
pnpm add timit
yarn add timit
bun add timit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-01-31 |
| First published | 2021-01-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 62.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | rciang |
| Maintainers | rcjiang |
| Keywords | performance, timeit, measure, execution time, intervals |

## Links

- npm: https://www.npmjs.com/package/timit
- Repository: https://github.com/rcjiang/timit
- Issues: https://github.com/rcjiang/timit/issues
- npm.io page: https://npm.io/package/timit

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-01-31

## README

Measure your javascript function execution time. Both browser and node are supported.
![node](asset/node1.png)

## install 
```cli
npm install 'timit'
```

## example
```js
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
| otpion | type | default | remark |
| -- | -- | -- | ---- |
| funcs | [Function] | - | function to test |
| argsList | Array | - | parameter sequence |
| repeat | Number | 5 | number of tests |
| numbers | Number | 1 | Code snippets that take very little time, run multiple times to zoom in  |
| digits | Number | 3 | display accuracy |
| output | Function | log | custom output |

> `digits` and `output` only support passing parameters through object.

---
_Source: https://npm.io/package/timit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
