# antutu-for-scripts

> Shows the results in the form of a table for which script how many resources were spent

Latest version **0.0.3** (published 2021-05-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install antutu-for-scripts
pnpm add antutu-for-scripts
yarn add antutu-for-scripts
bun add antutu-for-scripts
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-05-26 |
| First published | 2021-05-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 44.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mansur Maratov |
| Maintainers | maratov |
| Keywords | benchmark |

## Links

- npm: https://www.npmjs.com/package/antutu-for-scripts
- npm.io page: https://npm.io/package/antutu-for-scripts

## Dependencies (1)

- [console-table-printer](https://npm.io/package/console-table-printer.md) ^2.9.0

## Recent versions

- 0.0.3 (latest) — 2021-05-26
- 0.0.2 — 2021-05-26
- 0.0.1 — 2021-05-26

## README

# Antutu-for-scripts
Node.js progressive library to **find out which script spends how many resources**


## Description
Shows the results in the form of a table for which script how many resources were spent




## Installation

`$ npm install antutu-for-scripts  --save`

## Features
#### benchmark
`benchmark(pathToFile:string, numOfIterations: (string | number), numOfRuns: (string | number))`


> Runs the test numOfRuns times with numOfIterations times iterations

```js
	[
	  {
		title: 'Loop for',
		Cpu: 80.5,
		Memory: 1.8302,
		Time: 0.08496,
		infelicity: 0.03824,
		diffTime: '0.0000'
	  },
	  {
		title: 'Loop forEach',
		Cpu: 84.5,
		Memory: 1.84399,
		Time: 0.09969,
		infelicity: 0.02917,
		diffTime: '17.3376'
	  },
	  {
		title: 'Loop while',
		Cpu: 91.5,
		Memory: 1.81529,
		Time: 0.17535,
		infelicity: 0.10882,
		diffTime: '106.3912'
	  }
	]
```

#### print
`print(resultOfBenchmark)`

>  Prints the results as a table

Name of test | CPU (%) |  RAM (mb) | Time (ms) | Infelicity time (ms) | Difference from best time (%)
------------------ |  ------------------ | ------------------ | ------------------ | ------------------ | ------------------
 Loop forEach   | 83.75  | 1.8375  | 0.06969 | 0.10882  | 106.3912

## Structure of test file

```js
	module.exports = {
		title: 'Test file name',
		tests: [
			{
				title: 'Test name',
				method() {
					 // Сall or write a script that we want to test
				}
			},
		]
	};
```


## Usage

For projects in javascript:
```js
	 import {benchmark, print} from 'antutu-for-scripts';

	 try {
		 (async () => {
			 const benchmarkResult = await benchmark(pathToFile, numOfIterations, numOfRuns);
		 	 print(benchmarkResult);
		 })()
	 } catch(e) {
		 console.log(e.message);
		 process.exit(1);
	 }
```



For projects in typescript:
```ts
	import {benchmark, print, IBenchmarkResult} from 'antutu-for-scripts';
	
	try {
		 (async () => {
			 const benchmarkResult: IBenchmarkResult = await benchmark(pathToFile, numOfIterations, numOfRuns);
			 print(benchmarkResult);
		 })()
	 } catch(e) {
		 console.log(e.message);
		 process.exit(1);
	 }	 
```

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