nv-facutil-simple-test is an early-stage (version 0.0.22) JavaScript utility library designed for straightforward function execution and performance benchmarking. It provides mechanisms to execute synchronous functions (`sync`) and asynchronous functions (`async`) a specified number of times, measuring their execution cost. Additionally, it offers a `cmp` utility to compare the performance of multiple functions against each other. The library aims to offer a minimalistic API for quick, ad-hoc performance tests and basic function verification. Given its pre-1.0 versioning, it is currently in active development with an unspecified release cadence, implying that breaking changes may occur frequently. Its primary differentiator is its directness and simplicity for measuring execution time.
npm install nv-facutil-simple-testVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `sync` for synchronous tasks, `async` for asynchronous (Promise-based) operations, and `cmp` to benchmark the performance of several functions, illustrating basic usage patterns for each.
Pin to exact patch versions (`~0.0.x`) or be prepared to refactor code frequently. Consider using more mature benchmarking libraries for production environments.
Always use `await` with the `async` function call in an `async` context, or use `.then()` for Promise resolution: `const results = await async(...)` or `async(...).then(results => ...)`.
When using CommonJS, ensure all desired exports are explicitly destructured: `const {sync, async, Ahook, cmp} = require('nv-facutil-simple-test');`. For ESM, use `import { sync, async, Ahook, cmp } from 'nv-facutil-simple-test';`.For CommonJS environments, stick to `require()`. For ESM environments, try `import { ... } from 'nv-facutil-simple-test';`. If issues arise, check the Node.js module resolution settings or consider using a transpiler.Ensure 'cmp' is included in your import statement: `const { sync, async, cmp } = require('nv-facutil-simple-test');` or `import { sync, async, cmp } from 'nv-facutil-simple-test';`You must `await` the result of the `async` call (within an `async` function) or use a `.then()` callback to access the resolved performance metrics. Example: `const result = await async(...)` or `async(...).then(result => console.log(result))`.
No dependency data recorded yet.