0.0.16 • Published 1 year ago

@nevule/sac-tool v0.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

sac-tool

license npm

The math tool written in Rust

一款基于 Rust 实现的 数据计算

Install

$ npm i @nevule/sac-tool

Usage

import * as sac from '@nevule/sac-tool';
// 获取离群元素
sac.outliers(new Float64Array([1, 2, 3, 4, 3, 1, 2, 4, 10, 15])); // => [10, 15]

// Promise版本
import { Calculate } from '@nevule/sac-tool';
const sac = new Calculate();
await sac.outliers(new Float64Array([1, 2, 3, 4, 3, 1, 2, 4, 10, 15])); // => Promise<[10, 15]>

Test

const numbers = (new Array(10000000).fill(1).map(() => Math.random() * 1000000));

console.time('js')
js.coefficientOfVariation(numbers)
console.timeEnd('js') // 1.119s

console.time('rust')
sac.coefficientOfVariation(new Float64Array(numbers))
console.timeEnd('rust') // 122.788ms

console.time('rust-wasm')
wasm.coefficientOfVariation(new Float64Array(numbers))
console.timeEnd('rust-wasm') // 164.442ms

Support matrix

node14node16node18
Windows x64
Windows x32
Windows arm64
macOS x64
macOS arm64
Linux x64 gnu
Linux x64 musl
Linux arm gnu
Linux arm64 gnu
Linux arm64 musl
Android arm64
Android armv7
FreeBSD x64

License

MIT

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago