# @youba/yubaperf

> YubaPerf Library is for measuring code,algorithm and comparing them

Latest version **0.0.3** (published 2024-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @youba/yubaperf
pnpm add @youba/yubaperf
yarn add @youba/yubaperf
bun add @youba/yubaperf
```

## 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 | 2024-02-16 |
| First published | 2021-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 203.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ayoub touba |
| Maintainers | youba |
| Keywords | yubaperf, performance, comparing alogrithms, measuring |

## Links

- npm: https://www.npmjs.com/package/@youba/yubaperf
- Repository: https://github.com/AyubTouba/yubaperf
- Homepage: https://github.com/AyubTouba/yubaperf#readme
- Issues: https://github.com/AyubTouba/yubaperf
- npm.io page: https://npm.io/package/@youba/yubaperf

## Dependencies (1)

- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0

## 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

- 0.0.3 (latest) — 2024-02-16
- 0.0.2 — 2021-10-31

## README

**YubaPerf is for measuring code execution performance,comparing between functions code and generating chart to visualize the result .**

---

## Installation

```sh
npm i @youba/yubaperf
# OR
yarn add @youba/yubaperf
```

## Usage

- Comparing two functions and generating the chart to visualize the result, the result located on /perf/index.html file
- Ps: You can pass one function with multipel args to measure the performance that function as well

```typescript
import { Perfom } from "@youba/yubaperf";

function addUpToFirst(n) {
  var total = 0;
  for (var i = 0; i <= n; i++) {
    total += i;
  }
  return total;
}

function addUpToSecond(n) {
  return (n * (n + 1)) / 2;
}
let args = [
  1, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000,
];
Perfom.setfuncsToCompareSync([addUpToFirst, addUpToSecond], args);
Perfom.generateChart();
```

- Measure a function and return the result

```typescript
perf.start("addUpToFirst");
addUpToFirst(17777);
perf.end("addUpToFirst");
console.log(perf.result("addUpToFirst"));
```

### Functions

| name                         | parameters                                       | Description                                                                                                                                                               |
| ---------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| perfom.setfuncsToCompareSync | (arr: Array<any>, args: any,xValues::Array<any>) | arr: is array of sync functions to compare,args : args to use on the functions,as `args` may be a matrix the xValues parameter came to set bunch or Xvalues for the chart |
| perfom.generateChart()       | NONE                                             | generate chart to visualize the result                                                                                                                                    | the chart publish in the file chartjs/index.html |
| perf.start()                 | (name: string)                                   | name: the name of the performance instance to be started.                                                                                                                 |
| perf.end()                   | (name: string)                                   | name: the name of the performance to stop                                                                                                                                 |
| perf.result()                | (name: string,parsed?: boolean)                  | name: the name of the performance to return the result,parsed (default=true): return a readable result on (nano,mils,second time) or returning a bigint resutl            |

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