├── .gitignore ├── load-testing ├── node_modules │ ├── mitata │ ├── .pnpm │ │ ├── summary@0.3.2 │ │ │ └── node_modules │ │ │ │ └── summary │ │ │ │ ├── .npmignore │ │ │ │ ├── package.json │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ └── test.js │ │ ├── ttest@2.1.1 │ │ │ └── node_modules │ │ │ │ ├── summary │ │ │ │ ├── .npmignore │ │ │ │ ├── package.json │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ └── test.js │ │ │ │ ├── distributions │ │ │ │ ├── distributions.js │ │ │ │ ├── package.json │ │ │ │ ├── LICENSE.md │ │ │ │ ├── test │ │ │ │ │ ├── studentt.R │ │ │ │ │ ├── equal.js │ │ │ │ │ └── simple │ │ │ │ │ │ ├── studentt.js │ │ │ │ │ │ └── binomial.js │ │ │ │ └── distributions │ │ │ │ │ ├── normal.js │ │ │ │ │ ├── uniform.js │ │ │ │ │ ├── binomial.js │ │ │ │ │ └── studentt.js │ │ │ │ └── ttest │ │ │ │ ├── .eslintrc │ │ │ │ ├── hypothesis │ │ │ │ ├── one-data-set.js │ │ │ │ ├── two-data-set.js │ │ │ │ ├── welch.js │ │ │ │ └── abstact.js │ │ │ │ ├── package.json │ │ │ │ ├── test │ │ │ │ ├── equals.js │ │ │ │ └── simple │ │ │ │ │ ├── errors.js │ │ │ │ │ └── two-data-set.js │ │ │ │ └── LICENSE.md │ │ ├── autocannon-compare@0.4.0 │ │ │ └── node_modules │ │ │ │ ├── autocannon-compare │ │ │ │ ├── .travis.yml │ │ │ │ ├── node_modules │ │ │ │ │ └── .bin │ │ │ │ │ │ └── autocannon-compare │ │ │ │ ├── fixture-b.json │ │ │ │ ├── fixture-a.json │ │ │ │ ├── package.json │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── compare.js │ │ │ │ └── test.js │ │ │ │ └── ttest │ │ │ │ ├── .eslintrc │ │ │ │ ├── hypothesis │ │ │ │ ├── one-data-set.js │ │ │ │ ├── two-data-set.js │ │ │ │ ├── welch.js │ │ │ │ └── abstact.js │ │ │ │ ├── package.json │ │ │ │ ├── test │ │ │ │ ├── equals.js │ │ │ │ └── simple │ │ │ │ │ ├── errors.js │ │ │ │ │ └── two-data-set.js │ │ │ │ └── LICENSE.md │ │ ├── cephes@1.2.0 │ │ │ └── node_modules │ │ │ │ └── cephes │ │ │ │ ├── .babelrc │ │ │ │ ├── cephes.js │ │ │ │ ├── cephes-browser.js │ │ │ │ ├── cephes.wasm │ │ │ │ ├── cephes │ │ │ │ ├── planck.c │ │ │ │ ├── btdtr.c │ │ │ │ ├── round.c │ │ │ │ ├── cosh.c │ │ │ │ ├── expx2.c │ │ │ │ ├── chbevl.c │ │ │ │ ├── polevl.c │ │ │ │ ├── yn.c │ │ │ │ ├── gdtr.c │ │ │ │ ├── jn.c │ │ │ │ └── iv.c │ │ │ │ ├── article │ │ │ │ ├── d3.js │ │ │ │ ├── lib │ │ │ │ │ └── walkthrough.js │ │ │ │ ├── main.js │ │ │ │ └── style.css │ │ │ │ ├── build │ │ │ │ ├── c-defs.js │ │ │ │ ├── readme-footer.md │ │ │ │ ├── malloc_free.c │ │ │ │ ├── reader-cproto-parser.js │ │ │ │ └── reader.js │ │ │ │ ├── test │ │ │ │ ├── almost-equal.js │ │ │ │ ├── async.test.js │ │ │ │ ├── actual.test.js │ │ │ │ └── basic.test.js │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ └── package.json │ │ ├── distributions@2.1.0 │ │ │ └── node_modules │ │ │ │ ├── cephes │ │ │ │ ├── .babelrc │ │ │ │ ├── cephes.js │ │ │ │ ├── cephes-browser.js │ │ │ │ ├── cephes.wasm │ │ │ │ ├── cephes │ │ │ │ │ ├── planck.c │ │ │ │ │ ├── btdtr.c │ │ │ │ │ ├── round.c │ │ │ │ │ ├── cosh.c │ │ │ │ │ ├── expx2.c │ │ │ │ │ ├── chbevl.c │ │ │ │ │ ├── polevl.c │ │ │ │ │ ├── yn.c │ │ │ │ │ ├── gdtr.c │ │ │ │ │ ├── jn.c │ │ │ │ │ └── iv.c │ │ │ │ ├── article │ │ │ │ │ ├── d3.js │ │ │ │ │ ├── lib │ │ │ │ │ │ └── walkthrough.js │ │ │ │ │ ├── main.js │ │ │ │ │ └── style.css │ │ │ │ ├── build │ │ │ │ │ ├── c-defs.js │ │ │ │ │ ├── readme-footer.md │ │ │ │ │ ├── malloc_free.c │ │ │ │ │ ├── reader-cproto-parser.js │ │ │ │ │ └── reader.js │ │ │ │ ├── test │ │ │ │ │ ├── almost-equal.js │ │ │ │ │ ├── async.test.js │ │ │ │ │ ├── actual.test.js │ │ │ │ │ └── basic.test.js │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ └── package.json │ │ │ │ └── distributions │ │ │ │ ├── distributions.js │ │ │ │ ├── package.json │ │ │ │ ├── LICENSE.md │ │ │ │ ├── test │ │ │ │ ├── studentt.R │ │ │ │ ├── equal.js │ │ │ │ └── simple │ │ │ │ │ ├── studentt.js │ │ │ │ │ └── binomial.js │ │ │ │ └── distributions │ │ │ │ ├── normal.js │ │ │ │ ├── uniform.js │ │ │ │ ├── binomial.js │ │ │ │ └── studentt.js │ │ ├── mitata@0.1.6 │ │ │ └── node_modules │ │ │ │ └── mitata │ │ │ │ ├── build.rs │ │ │ │ ├── Cargo.toml │ │ │ │ ├── tests │ │ │ │ ├── no-bias.js │ │ │ │ ├── bias.js │ │ │ │ ├── test.js │ │ │ │ └── test.ts │ │ │ │ ├── package.json │ │ │ │ ├── reporter │ │ │ │ ├── fmt.mjs │ │ │ │ ├── table.mjs │ │ │ │ └── clr.mjs │ │ │ │ ├── LICENSE │ │ │ │ └── src │ │ │ │ ├── cli.d.ts │ │ │ │ ├── time.mjs │ │ │ │ └── main.rs │ │ └── lock.yaml │ ├── .ignored │ │ └── mitata │ │ │ ├── build.rs │ │ │ ├── Cargo.toml │ │ │ ├── tests │ │ │ ├── no-bias.js │ │ │ ├── bias.js │ │ │ ├── test.js │ │ │ └── test.ts │ │ │ ├── package.json │ │ │ ├── reporter │ │ │ ├── fmt.mjs │ │ │ ├── table.mjs │ │ │ └── clr.mjs │ │ │ ├── LICENSE │ │ │ └── src │ │ │ ├── cli.d.ts │ │ │ ├── time.mjs │ │ │ └── main.rs │ └── .modules.yaml ├── pnpm-lock.yaml ├── package.json └── index.mjs ├── package.json ├── 4-enums.ts ├── 1-basics.ts ├── 2-parsing.ts ├── 3-refine.ts └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | load-testing/node_modules -------------------------------------------------------------------------------- /load-testing/node_modules/mitata: -------------------------------------------------------------------------------- 1 | .pnpm/mitata@0.1.6/node_modules/mitata -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/summary@0.3.2/node_modules/summary/.npmignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules/ 3 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/summary/.npmignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules/ 3 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "8" 5 | - "10" 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": ["@babel/plugin-transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | unsafe { 3 | println!("cargo:rustc-env=TARGET={}", std::env::var("TARGET").unwrap_unchecked()); 4 | } 5 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": ["@babel/plugin-transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | unsafe { 3 | println!("cargo:rustc-env=TARGET={}", std::env::var("TARGET").unwrap_unchecked()); 4 | } 5 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes.js: -------------------------------------------------------------------------------- 1 | 2 | const CephesWrapper = require('./cephes-wrapper.js'); 3 | 4 | // Compile sync by default 5 | module.exports = new CephesWrapper(true); 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes.js: -------------------------------------------------------------------------------- 1 | 2 | const CephesWrapper = require('./cephes-wrapper.js'); 3 | 4 | // Compile sync by default 5 | module.exports = new CephesWrapper(true); 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes-browser.js: -------------------------------------------------------------------------------- 1 | 2 | const CephesWrapper = require('./cephes-wrapper.js'); 3 | 4 | // Compile async in the browser 5 | module.exports = new CephesWrapper(false); 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TomDoesTech/just-enough-zod-to-be-productive/HEAD/load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes.wasm -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/planck.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TomDoesTech/just-enough-zod-to-be-productive/HEAD/load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/planck.c -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes-browser.js: -------------------------------------------------------------------------------- 1 | 2 | const CephesWrapper = require('./cephes-wrapper.js'); 3 | 4 | // Compile async in the browser 5 | module.exports = new CephesWrapper(false); 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TomDoesTech/just-enough-zod-to-be-productive/HEAD/load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes.wasm -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/planck.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TomDoesTech/just-enough-zod-to-be-productive/HEAD/load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/planck.c -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'mitata' 3 | license = 'MIT' 4 | edition = '2021' 5 | version = '0.0.7' 6 | description = 'benchmarking lib/cli' 7 | 8 | [dependencies] 9 | clap = { version = '3', default-features = false, features = ['std', 'env', 'cargo', 'color'] } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/article/d3.js: -------------------------------------------------------------------------------- 1 | 2 | Object.assign( 3 | module.exports, 4 | require('d3-array'), 5 | require('d3-shape'), 6 | require('d3-selection'), 7 | require('d3-axis'), 8 | require('d3-scale'), 9 | require('d3-scale-chromatic') 10 | ); 11 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/article/d3.js: -------------------------------------------------------------------------------- 1 | 2 | Object.assign( 3 | module.exports, 4 | require('d3-array'), 5 | require('d3-shape'), 6 | require('d3-selection'), 7 | require('d3-axis'), 8 | require('d3-scale'), 9 | require('d3-scale-chromatic') 10 | ); 11 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'mitata' 3 | license = 'MIT' 4 | edition = '2021' 5 | version = '0.0.7' 6 | description = 'benchmarking lib/cli' 7 | 8 | [dependencies] 9 | clap = { version = '3', default-features = false, features = ['std', 'env', 'cargo', 'color'] } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/build/c-defs.js: -------------------------------------------------------------------------------- 1 | 2 | // The real functions are defined in cephes.js, this is just so 3 | // emscripten doesn't complain. 4 | mergeInto(LibraryManager.library, { 5 | mtherr: function(name /* char* */, code /* int */) { 6 | throw new Error(name); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/distributions.js: -------------------------------------------------------------------------------- 1 | 2 | exports.Normal = require('./distributions/normal.js'); 3 | exports.Studentt = require('./distributions/studentt.js'); 4 | exports.Uniform = require('./distributions/uniform.js'); 5 | exports.Binomial = require('./distributions/binomial.js'); 6 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/build/c-defs.js: -------------------------------------------------------------------------------- 1 | 2 | // The real functions are defined in cephes.js, this is just so 3 | // emscripten doesn't complain. 4 | mergeInto(LibraryManager.library, { 5 | mtherr: function(name /* char* */, code /* int */) { 6 | throw new Error(name); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/distributions.js: -------------------------------------------------------------------------------- 1 | 2 | exports.Normal = require('./distributions/normal.js'); 3 | exports.Studentt = require('./distributions/studentt.js'); 4 | exports.Uniform = require('./distributions/uniform.js'); 5 | exports.Binomial = require('./distributions/binomial.js'); 6 | -------------------------------------------------------------------------------- /load-testing/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.4 2 | 3 | specifiers: 4 | mitata: ^0.1.6 5 | 6 | dependencies: 7 | mitata: 0.1.6 8 | 9 | packages: 10 | 11 | /mitata/0.1.6: 12 | resolution: {integrity: sha512-VKQ0r3jriTOU9E2Z+mwbZrUmbg4Li4QyFfi7kfHKl6reZhGzL0AYlu3wE0VPXzIwA5xnFzmEQoBwCcNT8stUkA==} 13 | dev: false 14 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.4 2 | 3 | specifiers: 4 | mitata: ^0.1.6 5 | 6 | dependencies: 7 | mitata: 0.1.6 8 | 9 | packages: 10 | 11 | /mitata/0.1.6: 12 | resolution: {integrity: sha512-VKQ0r3jriTOU9E2Z+mwbZrUmbg4Li4QyFfi7kfHKl6reZhGzL0AYlu3wE0VPXzIwA5xnFzmEQoBwCcNT8stUkA==} 13 | dev: false 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "1": "tsx watch 1-basics.ts", 4 | "2": "tsx watch 2-parsing.ts", 5 | "3": "tsx watch 3-refine.ts", 6 | "4": "tsx watch 4-enums.ts" 7 | }, 8 | "dependencies": { 9 | "joi": "^17.7.0", 10 | "yup": "^0.32.11", 11 | "zod": "^3.20.2" 12 | }, 13 | "devDependencies": { 14 | "tsx": "^3.12.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /load-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "load-testing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index.mjs" 9 | }, 10 | "keywords": [], 11 | "author": "tomanagle", 12 | "license": "ISC", 13 | "dependencies": { 14 | "mitata": "^0.1.6" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/test/almost-equal.js: -------------------------------------------------------------------------------- 1 | 2 | const almostEqual = require('almost-equal'); 3 | 4 | function tapAlmostEqual(t, a, b, { atol=1e-8, rtol=1e-5 } = {}) { 5 | var result = almostEqual(a, b, atol, rtol); 6 | if (result) { 7 | t.ok(true, `${a} is almost equal to ${b}`); 8 | } else { 9 | t.ok(false, `${a} is not almost equal to ${b}`); 10 | } 11 | } 12 | 13 | module.exports = tapAlmostEqual; 14 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/build/readme-footer.md: -------------------------------------------------------------------------------- 1 | 2 | ## LICENSE 3 | 4 | The cephes library, that this module wraps, can be found at 5 | http://www.netlib.org/cephes/. The cephes library from the NetLib website, 6 | doesn't have any license. However, the author Stephen Moshier, has kindly given 7 | permission for it to be included in a BSD-licensed package. 8 | 9 | Please see the [LICENSE](LICENSE) file, for all the details. 10 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/test/almost-equal.js: -------------------------------------------------------------------------------- 1 | 2 | const almostEqual = require('almost-equal'); 3 | 4 | function tapAlmostEqual(t, a, b, { atol=1e-8, rtol=1e-5 } = {}) { 5 | var result = almostEqual(a, b, atol, rtol); 6 | if (result) { 7 | t.ok(true, `${a} is almost equal to ${b}`); 8 | } else { 9 | t.ok(false, `${a} is not almost equal to ${b}`); 10 | } 11 | } 12 | 13 | module.exports = tapAlmostEqual; 14 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/build/readme-footer.md: -------------------------------------------------------------------------------- 1 | 2 | ## LICENSE 3 | 4 | The cephes library, that this module wraps, can be found at 5 | http://www.netlib.org/cephes/. The cephes library from the NetLib website, 6 | doesn't have any license. However, the author Stephen Moshier, has kindly given 7 | permission for it to be included in a BSD-licensed package. 8 | 9 | Please see the [LICENSE](LICENSE) file, for all the details. 10 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/tests/no-bias.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | const fn = () => {}; 4 | 5 | bench('noop', fn); 6 | bench('noop', fn); 7 | bench('noop', fn); 8 | bench('noop', fn); 9 | bench('noop', fn); 10 | bench('noop', fn); 11 | bench('noop', fn); 12 | bench('noop', fn); 13 | bench('noop', fn); 14 | bench('noop', fn); 15 | bench('noop', fn); 16 | bench('noop', fn); 17 | bench('noop', fn); 18 | 19 | await run({ percentiles: false }); -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mitata", 3 | "type": "module", 4 | "license": "MIT", 5 | "version": "0.1.6", 6 | "main": "src/cli.mjs", 7 | "types": "src/cli.d.ts", 8 | "description": "cross-runtime benchmarking lib", 9 | "homepage": "https://github.com/evanwashere/mitata#readme", 10 | "bugs": { "url": "https://github.com/evanwashere/mitata/issues" }, 11 | "repository": { "type": "git", "url": "git+https://github.com/evanwashere/mitata.git" } 12 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/tests/no-bias.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | const fn = () => {}; 4 | 5 | bench('noop', fn); 6 | bench('noop', fn); 7 | bench('noop', fn); 8 | bench('noop', fn); 9 | bench('noop', fn); 10 | bench('noop', fn); 11 | bench('noop', fn); 12 | bench('noop', fn); 13 | bench('noop', fn); 14 | bench('noop', fn); 15 | bench('noop', fn); 16 | bench('noop', fn); 17 | bench('noop', fn); 18 | 19 | await run({ percentiles: false }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mitata", 3 | "type": "module", 4 | "license": "MIT", 5 | "version": "0.1.6", 6 | "main": "src/cli.mjs", 7 | "types": "src/cli.d.ts", 8 | "description": "cross-runtime benchmarking lib", 9 | "homepage": "https://github.com/evanwashere/mitata#readme", 10 | "bugs": { "url": "https://github.com/evanwashere/mitata/issues" }, 11 | "repository": { "type": "git", "url": "git+https://github.com/evanwashere/mitata.git" } 12 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/tests/bias.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | bench('noop', () => {}); 5 | bench('noop', () => {}); 6 | bench('noop', () => {}); 7 | bench('noop', () => {}); 8 | bench('noop', () => {}); 9 | bench('noop', () => {}); 10 | bench('noop', () => {}); 11 | bench('noop', () => {}); 12 | bench('noop', () => {}); 13 | bench('noop', () => {}); 14 | bench('noop', () => {}); 15 | bench('noop', () => {}); 16 | 17 | await run({ percentiles: false }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/tests/bias.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | bench('noop', () => {}); 5 | bench('noop', () => {}); 6 | bench('noop', () => {}); 7 | bench('noop', () => {}); 8 | bench('noop', () => {}); 9 | bench('noop', () => {}); 10 | bench('noop', () => {}); 11 | bench('noop', () => {}); 12 | bench('noop', () => {}); 13 | bench('noop', () => {}); 14 | bench('noop', () => {}); 15 | bench('noop', () => {}); 16 | 17 | await run({ percentiles: false }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": "eslint:recommended", 4 | "env": { 5 | "node": true, 6 | "es6": true 7 | }, 8 | "rules": { 9 | "indent": [2, 2], 10 | "quotes": [1, "single", "avoid-escape"], 11 | "curly": 0, 12 | "strict": [2, "global"], 13 | "no-shadow": 0, 14 | "no-underscore-dangle": 0, 15 | "no-use-before-define": [1, "nofunc"], 16 | "prefer-spread": 1, 17 | "prefer-const": 1, 18 | "no-console": 0, 19 | "no-var": 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": "eslint:recommended", 4 | "env": { 5 | "node": true, 6 | "es6": true 7 | }, 8 | "rules": { 9 | "indent": [2, 2], 10 | "quotes": [1, "single", "avoid-escape"], 11 | "curly": 0, 12 | "strict": [2, "global"], 13 | "no-shadow": 0, 14 | "no-underscore-dangle": 0, 15 | "no-use-before-define": [1, "nofunc"], 16 | "prefer-spread": 1, 17 | "prefer-const": 1, 18 | "no-console": 0, 19 | "no-var": 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /4-enums.ts: -------------------------------------------------------------------------------- 1 | import z from "zod"; 2 | 3 | const ut = ["admin", "user", "guest"] as const; 4 | 5 | const userTypes = z.enum(); 6 | 7 | type UserTypes = z.infer; 8 | 9 | enum UserTypeNative { 10 | admin = "Admin", 11 | user = "User", 12 | guest = "Guest", 13 | } 14 | 15 | const userSchema = z.object({ 16 | name: z.string(), 17 | type: z.nativeEnum(UserTypeNative), 18 | }); 19 | 20 | type User = z.infer; 21 | 22 | const user: User = { 23 | name: "John Doe", 24 | type: "Admin", 25 | }; 26 | 27 | console.log(userSchema.parse(user)); 28 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/build/malloc_free.c: -------------------------------------------------------------------------------- 1 | 2 | /* Used for removing _malloc and _free in the exports. 3 | * 4 | * This will generate a warning but it is worth not having to deal with the 5 | * extra memory mangement (dead functions and pointers) that are never going 6 | * to be used. 7 | */ 8 | 9 | /* Hack, such that mconf.h is not added dynamically */ 10 | /* #include "mconf.h" */ 11 | 12 | void *__attribute__((noinline)) malloc(unsigned long size) { return (void *)0; } 13 | 14 | void __attribute__((noinline)) free(void *ptr) { return; } 15 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/build/malloc_free.c: -------------------------------------------------------------------------------- 1 | 2 | /* Used for removing _malloc and _free in the exports. 3 | * 4 | * This will generate a warning but it is worth not having to deal with the 5 | * extra memory mangement (dead functions and pointers) that are never going 6 | * to be used. 7 | */ 8 | 9 | /* Hack, such that mconf.h is not added dynamically */ 10 | /* #include "mconf.h" */ 11 | 12 | void *__attribute__((noinline)) malloc(unsigned long size) { return (void *)0; } 13 | 14 | void __attribute__((noinline)) free(void *ptr) { return; } 15 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/hypothesis/one-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(data, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | this._df = data.size - 1; 12 | this._dist = new Distribution(this._df); 13 | 14 | this._se = Math.sqrt(data.variance / data.size); 15 | this._mean = data.mean; 16 | } 17 | util.inherits(StudentT, AbstactStudentT); 18 | module.exports = StudentT; 19 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/hypothesis/one-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(data, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | this._df = data.size - 1; 12 | this._dist = new Distribution(this._df); 13 | 14 | this._se = Math.sqrt(data.variance / data.size); 15 | this._mean = data.mean; 16 | } 17 | util.inherits(StudentT, AbstactStudentT); 18 | module.exports = StudentT; 19 | -------------------------------------------------------------------------------- /load-testing/node_modules/.modules.yaml: -------------------------------------------------------------------------------- 1 | hoistPattern: 2 | - '*' 3 | hoistedDependencies: {} 4 | included: 5 | dependencies: true 6 | devDependencies: true 7 | optionalDependencies: true 8 | injectedDeps: {} 9 | layoutVersion: 5 10 | nodeLinker: isolated 11 | packageManager: pnpm@7.5.2 12 | pendingBuilds: [] 13 | prunedAt: Sat, 28 Jan 2023 23:58:15 GMT 14 | publicHoistPattern: 15 | - '*eslint*' 16 | - '*prettier*' 17 | registries: 18 | '@fortawesome': https://npm.fontawesome.com/ 19 | default: https://registry.npmjs.org/ 20 | skipped: [] 21 | storeDir: /Users/tom/Library/pnpm/store/v3 22 | virtualStoreDir: .pnpm 23 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/node_modules/.bin/autocannon-compare: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -z "$NODE_PATH" ]; then 9 | export NODE_PATH="/Users/tom/projects/zod-pre/load-testing/node_modules/.pnpm/node_modules" 10 | else 11 | export NODE_PATH="$NODE_PATH:/Users/tom/projects/zod-pre/load-testing/node_modules/.pnpm/node_modules" 12 | fi 13 | if [ -x "$basedir/node" ]; then 14 | exec "$basedir/node" "$basedir/../../compare.js" "$@" 15 | else 16 | exec node "$basedir/../../compare.js" "$@" 17 | fi 18 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/reporter/fmt.mjs: -------------------------------------------------------------------------------- 1 | export function duration(time, locale = 'en-us') { 2 | if (time < 1e0) return `${Number((time * 1e3).toFixed(2)).toLocaleString(locale)} ps` 3 | 4 | if (time < 1e3) return `${Number(time.toFixed(2)).toLocaleString(locale)} ns`; 5 | if (time < 1e6) return `${Number((time / 1e3).toFixed(2)).toLocaleString(locale)} µs`; 6 | if (time < 1e9) return `${Number((time / 1e6).toFixed(2)).toLocaleString(locale)} ms`; 7 | if (time < 1e12) return `${Number((time / 1e9).toFixed(2)).toLocaleString(locale)} s`; 8 | if (time < 36e11) return `${Number((time / 60e9).toFixed(2)).toLocaleString(locale)} m`; 9 | 10 | return `${Number((time / 36e11).toFixed(2)).toLocaleString(locale)} h`; 11 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "distributions", 3 | "description": "A collection of probability distribution functions", 4 | "version": "2.1.0", 5 | "author": "Andreas Madsen ", 6 | "main": "./distributions.js", 7 | "scripts": { 8 | "test": "tap test/simple/*" 9 | }, 10 | "repository" : { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/distributions.git" 13 | }, 14 | "keywords": [ 15 | "distribution", 16 | "normal", 17 | "studentt", 18 | "uniform" 19 | ], 20 | "dependencies": { 21 | "cephes": "^1.1.2" 22 | }, 23 | "devDependencies": { 24 | "tap": "^12.1.0" 25 | }, 26 | "license": "MIT" 27 | } 28 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ttest", 3 | "description": "Perform the Student's t hypothesis test", 4 | "version": "2.1.1", 5 | "author": "Andreas Madsen ", 6 | "main": "./hypothesis.js", 7 | "scripts": { 8 | "test": "tap test/simple/* && eslint ." 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/ttest.git" 13 | }, 14 | "keywords": [ 15 | "hypothesis", 16 | "student t" 17 | ], 18 | "dependencies": { 19 | "summary": "0.3.x", 20 | "distributions": "^2.1.0" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^3.19.0", 24 | "tap": "^12.7.0" 25 | }, 26 | "license": "MIT" 27 | } 28 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/reporter/fmt.mjs: -------------------------------------------------------------------------------- 1 | export function duration(time, locale = 'en-us') { 2 | if (time < 1e0) return `${Number((time * 1e3).toFixed(2)).toLocaleString(locale)} ps` 3 | 4 | if (time < 1e3) return `${Number(time.toFixed(2)).toLocaleString(locale)} ns`; 5 | if (time < 1e6) return `${Number((time / 1e3).toFixed(2)).toLocaleString(locale)} µs`; 6 | if (time < 1e9) return `${Number((time / 1e6).toFixed(2)).toLocaleString(locale)} ms`; 7 | if (time < 1e12) return `${Number((time / 1e9).toFixed(2)).toLocaleString(locale)} s`; 8 | if (time < 36e11) return `${Number((time / 60e9).toFixed(2)).toLocaleString(locale)} m`; 9 | 10 | return `${Number((time / 36e11).toFixed(2)).toLocaleString(locale)} h`; 11 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/summary@0.3.2/node_modules/summary/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "summary", 3 | "description": "Takes an array of numbers and calculates some descriptive statistics", 4 | "version": "0.3.2", 5 | "author": "Andreas Madsen ", 6 | "main": "./summary.js", 7 | "scripts": { 8 | "test": "tap test.js" 9 | }, 10 | "repository" : { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/summary.git" 13 | }, 14 | "keywords": [ 15 | "summary", 16 | "sort", 17 | "size", 18 | "mode", 19 | "mean", 20 | "quartile", 21 | "median", 22 | "variance", 23 | "sd" 24 | ], 25 | "devDependencies": { 26 | "tap": "0.6.x" 27 | }, 28 | "license": "MIT" 29 | } 30 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/summary/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "summary", 3 | "description": "Takes an array of numbers and calculates some descriptive statistics", 4 | "version": "0.3.2", 5 | "author": "Andreas Madsen ", 6 | "main": "./summary.js", 7 | "scripts": { 8 | "test": "tap test.js" 9 | }, 10 | "repository" : { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/summary.git" 13 | }, 14 | "keywords": [ 15 | "summary", 16 | "sort", 17 | "size", 18 | "mode", 19 | "mean", 20 | "quartile", 21 | "median", 22 | "variance", 23 | "sd" 24 | ], 25 | "devDependencies": { 26 | "tap": "0.6.x" 27 | }, 28 | "license": "MIT" 29 | } 30 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "distributions", 3 | "description": "A collection of probability distribution functions", 4 | "version": "2.1.0", 5 | "author": "Andreas Madsen ", 6 | "main": "./distributions.js", 7 | "scripts": { 8 | "test": "tap test/simple/*" 9 | }, 10 | "repository" : { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/distributions.git" 13 | }, 14 | "keywords": [ 15 | "distribution", 16 | "normal", 17 | "studentt", 18 | "uniform" 19 | ], 20 | "dependencies": { 21 | "cephes": "^1.1.2" 22 | }, 23 | "devDependencies": { 24 | "tap": "^12.1.0" 25 | }, 26 | "license": "MIT" 27 | } 28 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ttest", 3 | "description": "Perform the Student's t hypothesis test", 4 | "version": "2.1.1", 5 | "author": "Andreas Madsen ", 6 | "main": "./hypothesis.js", 7 | "scripts": { 8 | "test": "tap test/simple/* && eslint ." 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/AndreasMadsen/ttest.git" 13 | }, 14 | "keywords": [ 15 | "hypothesis", 16 | "student t" 17 | ], 18 | "dependencies": { 19 | "summary": "0.3.x", 20 | "distributions": "^2.1.0" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^3.19.0", 24 | "tap": "^12.7.0" 25 | }, 26 | "license": "MIT" 27 | } 28 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/hypothesis/two-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(left, right, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | this._df = left.size + right.size - 2; 12 | this._dist = new Distribution(this._df); 13 | 14 | const commonVariance = ((left.size - 1) * left.variance + 15 | (right.size - 1) * right.variance 16 | ) / this._df; 17 | 18 | this._se = Math.sqrt(commonVariance * (1 / left.size + 1 / right.size)); 19 | this._mean = left.mean - right.mean; 20 | } 21 | util.inherits(StudentT, AbstactStudentT); 22 | module.exports = StudentT; 23 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/hypothesis/two-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(left, right, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | this._df = left.size + right.size - 2; 12 | this._dist = new Distribution(this._df); 13 | 14 | const commonVariance = ((left.size - 1) * left.variance + 15 | (right.size - 1) * right.variance 16 | ) / this._df; 17 | 18 | this._se = Math.sqrt(commonVariance * (1 / left.size + 1 / right.size)); 19 | this._mean = left.mean - right.mean; 20 | } 21 | util.inherits(StudentT, AbstactStudentT); 22 | module.exports = StudentT; 23 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/hypothesis/welch.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(left, right, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | const leftSE = left.variance / left.size; 12 | const rightSE = right.variance / right.size; 13 | const commonVariance = leftSE + rightSE; 14 | 15 | this._df = Math.pow(commonVariance, 2) / ( 16 | Math.pow(leftSE, 2) / (left.size - 1) + 17 | Math.pow(rightSE, 2) / (right.size - 1) 18 | ); 19 | this._dist = new Distribution(this._df); 20 | 21 | this._se = Math.sqrt(commonVariance); 22 | this._mean = left.mean - right.mean; 23 | } 24 | util.inherits(StudentT, AbstactStudentT); 25 | module.exports = StudentT; 26 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/hypothesis/welch.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Distribution = require('distributions').Studentt; 4 | 5 | const util = require('util'); 6 | const AbstactStudentT = require('./abstact.js'); 7 | 8 | function StudentT(left, right, options) { 9 | AbstactStudentT.call(this, options); 10 | 11 | const leftSE = left.variance / left.size; 12 | const rightSE = right.variance / right.size; 13 | const commonVariance = leftSE + rightSE; 14 | 15 | this._df = Math.pow(commonVariance, 2) / ( 16 | Math.pow(leftSE, 2) / (left.size - 1) + 17 | Math.pow(rightSE, 2) / (right.size - 1) 18 | ); 19 | this._dist = new Distribution(this._df); 20 | 21 | this._se = Math.sqrt(commonVariance); 22 | this._mean = left.mean - right.mean; 23 | } 24 | util.inherits(StudentT, AbstactStudentT); 25 | module.exports = StudentT; 26 | -------------------------------------------------------------------------------- /1-basics.ts: -------------------------------------------------------------------------------- 1 | import z from "zod"; 2 | 3 | const schema = z.object({ 4 | name: z.string({ 5 | required_error: "Name is required", 6 | invalid_type_error: "Name must be a string", 7 | }), 8 | age: z.number(), 9 | isAlive: z.boolean(), 10 | hobbies: z.array(z.string()), 11 | address: z.object({ 12 | street: z.string(), 13 | }), 14 | }); 15 | 16 | type CreateUserInput = z.infer; 17 | 18 | function createUser(props: CreateUserInput) { 19 | const result = schema.parse(props); 20 | 21 | return result; 22 | } 23 | 24 | const payload: CreateUserInput = { 25 | name: "John Doe", 26 | age: 30, 27 | isAlive: true, 28 | hobbies: ["coding", "reading"], 29 | address: { 30 | street: "123 Main St", 31 | }, 32 | // @ts-ignore 33 | isUnknown: true, 34 | }; 35 | 36 | const result = createUser(payload); 37 | 38 | console.log(JSON.stringify(result, null, 2)); 39 | -------------------------------------------------------------------------------- /2-parsing.ts: -------------------------------------------------------------------------------- 1 | import z from "zod"; 2 | 3 | const schema = z.object({ 4 | name: z.string({ 5 | required_error: "Name is required", 6 | invalid_type_error: "Name must be a string", 7 | }), 8 | age: z.number(), 9 | isAlive: z.boolean(), 10 | hobbies: z.array(z.string()), 11 | address: z.object({ 12 | street: z.string(), 13 | }), 14 | }); 15 | 16 | type CreateUserInput = z.infer; 17 | 18 | function createUser(props: CreateUserInput) { 19 | const result = schema.safeParse(props); 20 | 21 | return result; 22 | } 23 | 24 | const payload: CreateUserInput = { 25 | // name: "John Doe", 26 | age: 30, 27 | isAlive: true, 28 | hobbies: ["coding", "reading"], 29 | address: { 30 | street: "123 Main St", 31 | }, 32 | // @ts-ignore 33 | isUnknown: true, 34 | }; 35 | 36 | const result = createUser(payload); 37 | 38 | console.log(JSON.stringify(result, null, 2)); 39 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We love to get pull requests, but please restrict it to be directly related 4 | to the cephes library from http://www.netlib.org/cephes/. 5 | 6 | ## Dependencies 7 | 8 | To compile `node-cephes` you must have the following installed: 9 | 10 | * `clang-format`: https://github.com/angular/clang-format#readme 11 | * `cproto`: http://cproto.sourceforge.net/, on MacOS `brew install cproto` will work fine. 12 | * `emscripten`: http://emscripten.org/, see install instructions here: http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html 13 | * The package dev-dependencies, use `npm install` 14 | 15 | ## Download Cephes Library 16 | 17 | To re-download the cephes library run: 18 | 19 | ``` 20 | make download 21 | ``` 22 | 23 | ## Compile 24 | 25 | To compile: 26 | 27 | ``` 28 | make build 29 | ``` 30 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We love to get pull requests, but please restrict it to be directly related 4 | to the cephes library from http://www.netlib.org/cephes/. 5 | 6 | ## Dependencies 7 | 8 | To compile `node-cephes` you must have the following installed: 9 | 10 | * `clang-format`: https://github.com/angular/clang-format#readme 11 | * `cproto`: http://cproto.sourceforge.net/, on MacOS `brew install cproto` will work fine. 12 | * `emscripten`: http://emscripten.org/, see install instructions here: http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html 13 | * The package dev-dependencies, use `npm install` 14 | 15 | ## Download Cephes Library 16 | 17 | To re-download the cephes library run: 18 | 19 | ``` 20 | make download 21 | ``` 22 | 23 | ## Compile 24 | 25 | To compile: 26 | 27 | ``` 28 | make build 29 | ``` 30 | -------------------------------------------------------------------------------- /3-refine.ts: -------------------------------------------------------------------------------- 1 | import z from "zod"; 2 | 3 | const schema = z 4 | .object({ 5 | name: z.string({ 6 | required_error: "Name is required", 7 | invalid_type_error: "Name must be a string", 8 | }), 9 | password: z.string({}).min(6, "Password must be at least 6 characters"), 10 | confirmPassword: z.string({}), 11 | }) 12 | .refine( 13 | (data) => { 14 | return data.password === data.confirmPassword; 15 | }, 16 | { 17 | message: "Passwords do not match", 18 | } 19 | ); 20 | 21 | type CreateUserInput = z.infer; 22 | 23 | function createUser(props: CreateUserInput) { 24 | const result = schema.parse(props); 25 | 26 | return result; 27 | } 28 | 29 | const payload: CreateUserInput = { 30 | name: "John Doe", 31 | password: "123456", 32 | confirmPassword: "123456", 33 | }; 34 | 35 | const result = createUser(payload); 36 | 37 | console.log(JSON.stringify(result, null, 2)); 38 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/article/lib/walkthrough.js: -------------------------------------------------------------------------------- 1 | 2 | const events = require('events'); 3 | const d3 = require('../d3.js'); 4 | 5 | class Walkthrough extends events.EventEmitter { 6 | constructor({ container }) { 7 | super(); 8 | this._container = d3.select(container); 9 | 10 | this._steps = this._container.selectAll('.ar-walkthrough-step'); 11 | this._pages = this._container.selectAll('.ar-walkthrough-page') 12 | .on('click', (d) => this.emit('click', d)); 13 | 14 | const itemNumbers = this._steps.nodes() 15 | .map((element, index) => index + 1); 16 | this._pages.data(itemNumbers); 17 | this._steps.data(itemNumbers); 18 | 19 | this._selectedItem = 1; 20 | } 21 | 22 | select(itemNumber) { 23 | this._selectedItem = itemNumber; 24 | } 25 | 26 | draw() { 27 | this._steps 28 | .classed('ar-walkthrough-selected', (d) => d === this._selectedItem); 29 | } 30 | } 31 | 32 | module.exports = Walkthrough; 33 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/article/lib/walkthrough.js: -------------------------------------------------------------------------------- 1 | 2 | const events = require('events'); 3 | const d3 = require('../d3.js'); 4 | 5 | class Walkthrough extends events.EventEmitter { 6 | constructor({ container }) { 7 | super(); 8 | this._container = d3.select(container); 9 | 10 | this._steps = this._container.selectAll('.ar-walkthrough-step'); 11 | this._pages = this._container.selectAll('.ar-walkthrough-page') 12 | .on('click', (d) => this.emit('click', d)); 13 | 14 | const itemNumbers = this._steps.nodes() 15 | .map((element, index) => index + 1); 16 | this._pages.data(itemNumbers); 17 | this._steps.data(itemNumbers); 18 | 19 | this._selectedItem = 1; 20 | } 21 | 22 | select(itemNumber) { 23 | this._selectedItem = itemNumber; 24 | } 25 | 26 | draw() { 27 | this._steps 28 | .classed('ar-walkthrough-selected', (d) => d === this._selectedItem); 29 | } 30 | } 31 | 32 | module.exports = Walkthrough; 33 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 evanwashere 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cephes", 3 | "description": "Implementation of special functions and distributions mathematical functions from the cephes library.", 4 | "repository": "nearform/node-cephes", 5 | "version": "1.2.0", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "tap test/*.test.js" 9 | }, 10 | "dependencies": {}, 11 | "devDependencies": { 12 | "@babel/core": "^7.1.0", 13 | "@babel/plugin-transform-runtime": "^7.1.0", 14 | "@babel/preset-env": "^7.1.0", 15 | "@babel/runtime": "^7.0.0", 16 | "almost-equal": "^1.1.0", 17 | "babelify": "^10.0.0", 18 | "d3-array": "^1.2.4", 19 | "d3-axis": "^1.0.12", 20 | "d3-scale": "^2.1.2", 21 | "d3-scale-chromatic": "^1.3.3", 22 | "d3-selection": "^1.3.2", 23 | "d3-shape": "^1.2.2", 24 | "pumpify": "^1.5.1", 25 | "split2": "^3.0.0", 26 | "tap": "^12.0.1", 27 | "xorshift": "^1.1.1" 28 | }, 29 | "browser": { 30 | "./cephes.js": "./cephes-browser.js" 31 | }, 32 | "license": "BSD-3-Clause" 33 | } 34 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/fixture-b.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://localhost:3000", 3 | "requests": { 4 | "average": 1697.6, 5 | "mean": 1697.6, 6 | "stddev": 10.72, 7 | "min": 1680, 8 | "max": 1715, 9 | "total": 16976, 10 | "sent": 16986 11 | }, 12 | "latency": { 13 | "average": 5.51, 14 | "mean": 5.51, 15 | "stddev": 1.65, 16 | "min": 2, 17 | "max": 19, 18 | "p50": 5, 19 | "p75": 5, 20 | "p90": 10, 21 | "p99": 10, 22 | "p999": 12, 23 | "p9999": 17, 24 | "p99999": 19 25 | }, 26 | "throughput": { 27 | "average": 188416, 28 | "mean": 188416, 29 | "stddev": 4096, 30 | "min": 180224, 31 | "max": 196607, 32 | "total": 1884336 33 | }, 34 | "errors": 0, 35 | "timeouts": 0, 36 | "duration": 10, 37 | "start": "2017-02-16T09:21:43.354Z", 38 | "finish": "2017-02-16T09:21:53.381Z", 39 | "connections": 10, 40 | "pipelining": 1, 41 | "non2xx": 0, 42 | "1xx": 0, 43 | "2xx": 16976, 44 | "3xx": 0, 45 | "4xx": 0, 46 | "5xx": 0 47 | } 48 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cephes", 3 | "description": "Implementation of special functions and distributions mathematical functions from the cephes library.", 4 | "repository": "nearform/node-cephes", 5 | "version": "1.2.0", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "tap test/*.test.js" 9 | }, 10 | "dependencies": {}, 11 | "devDependencies": { 12 | "@babel/core": "^7.1.0", 13 | "@babel/plugin-transform-runtime": "^7.1.0", 14 | "@babel/preset-env": "^7.1.0", 15 | "@babel/runtime": "^7.0.0", 16 | "almost-equal": "^1.1.0", 17 | "babelify": "^10.0.0", 18 | "d3-array": "^1.2.4", 19 | "d3-axis": "^1.0.12", 20 | "d3-scale": "^2.1.2", 21 | "d3-scale-chromatic": "^1.3.3", 22 | "d3-selection": "^1.3.2", 23 | "d3-shape": "^1.2.2", 24 | "pumpify": "^1.5.1", 25 | "split2": "^3.0.0", 26 | "tap": "^12.0.1", 27 | "xorshift": "^1.1.1" 28 | }, 29 | "browser": { 30 | "./cephes.js": "./cephes-browser.js" 31 | }, 32 | "license": "BSD-3-Clause" 33 | } 34 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 evanwashere 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zod 2 | 3 | ## What is Zod? 4 | * Parse data with a pre-defined schema 5 | * TypeScript-first 6 | 7 | ## Validate vs Parse 8 | * Validate: check if data is valid 9 | * Parse: check if data is valid and return the parsed data 10 | 11 | ## TypeScript vs Zod 12 | * TypeScript: Static type checking 13 | * Zod: Parse at runtime 14 | 15 | ## Use cases 16 | * Parse form data before sending to the server 17 | * Parse data before sending back out to the client 18 | * Parse data at the API boundary before sending to the database 19 | * Parse data in functions around your application 20 | * Parse data from an external data source 21 | 22 | 23 | ## Important parts 24 | ### Basics 25 | * Defining a schema 26 | * Parsing data with a schema 27 | * Infer TypeScript types from a schema 28 | * Custom error messages 29 | * Different data types (object, array, string, number, boolean, etc.) 30 | 31 | ### Parsing 32 | * parse 33 | * safeParse 34 | * strict 35 | * passThrough 36 | 37 | ### Refine 38 | * Validate one field against another 39 | * parseAsync 40 | 41 | ### Enums 42 | * Zod enums 43 | * Native enums 44 | 45 | ## Benchmarks -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/fixture-a.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://localhost:3000", 3 | "requests": { 4 | "average": 18339.64, 5 | "mean": 18339.64, 6 | "stddev": 643.45, 7 | "min": 16448, 8 | "max": 18863, 9 | "total": 201763, 10 | "sent": 201773 11 | }, 12 | "latency": { 13 | "average": 0.06, 14 | "mean": 0.06, 15 | "stddev": 0.28, 16 | "min": 0, 17 | "max": 19, 18 | "p50": 0, 19 | "p75": 0, 20 | "p90": 0, 21 | "p99": 1, 22 | "p999": 2, 23 | "p9999": 6, 24 | "p99999": 18 25 | }, 26 | "throughput": { 27 | "average": 2028637.1, 28 | "mean": 2028637.1, 29 | "stddev": 75830.65, 30 | "min": 1769472, 31 | "max": 2097151, 32 | "total": 22395693 33 | }, 34 | "errors": 0, 35 | "timeouts": 0, 36 | "duration": 11, 37 | "start": "2017-02-16T09:05:37.354Z", 38 | "finish": "2017-02-16T09:05:48.379Z", 39 | "connections": 10, 40 | "pipelining": 1, 41 | "non2xx": 0, 42 | "1xx": 0, 43 | "2xx": 201763, 44 | "3xx": 0, 45 | "4xx": 0, 46 | "5xx": 0 47 | } 48 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/test/equals.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function equals(t, actual, expected) { 4 | 5 | t.strictEqual(actual.valid(), expected.valid, 'valid result match'); 6 | 7 | t.equal(actual.freedom(), expected.freedom, 'degree of freedom match'); 8 | 9 | match(t, actual.testValue(), expected.testValue, 'test value'); 10 | 11 | match(t, actual.pValue(), expected.pValue, 'p-value'); 12 | 13 | if (Number.isFinite(expected.confidence[0])) { 14 | match(t, actual.confidence()[0], expected.confidence[0], 'left confidence'); 15 | } else { 16 | t.equal(actual.confidence()[0], expected.confidence[0], 'left confidence match'); 17 | } 18 | 19 | if (Number.isFinite(expected.confidence[1])) { 20 | match(t, actual.confidence()[1], expected.confidence[1], 'right confidence'); 21 | } else { 22 | t.equal(actual.confidence()[1], expected.confidence[1], 'right confidence match'); 23 | } 24 | } 25 | module.exports = equals; 26 | 27 | function match(t, actual, expected, name) { 28 | t.ok(Math.abs(actual - expected) <= 0.0000005, `${name} ${actual} match ${expected}`); 29 | } 30 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/test/equals.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function equals(t, actual, expected) { 4 | 5 | t.strictEqual(actual.valid(), expected.valid, 'valid result match'); 6 | 7 | t.equal(actual.freedom(), expected.freedom, 'degree of freedom match'); 8 | 9 | match(t, actual.testValue(), expected.testValue, 'test value'); 10 | 11 | match(t, actual.pValue(), expected.pValue, 'p-value'); 12 | 13 | if (Number.isFinite(expected.confidence[0])) { 14 | match(t, actual.confidence()[0], expected.confidence[0], 'left confidence'); 15 | } else { 16 | t.equal(actual.confidence()[0], expected.confidence[0], 'left confidence match'); 17 | } 18 | 19 | if (Number.isFinite(expected.confidence[1])) { 20 | match(t, actual.confidence()[1], expected.confidence[1], 'right confidence'); 21 | } else { 22 | t.equal(actual.confidence()[1], expected.confidence[1], 'right confidence match'); 23 | } 24 | } 25 | module.exports = equals; 26 | 27 | function match(t, actual, expected, name) { 28 | t.ok(Math.abs(actual - expected) <= 0.0000005, `${name} ${actual} match ${expected}`); 29 | } 30 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "autocannon-compare", 3 | "version": "0.4.0", 4 | "description": "Compare two autocannon runs Edit", 5 | "main": "./compare.js", 6 | "bin": { 7 | "autocannon-compare": "./compare.js" 8 | }, 9 | "scripts": { 10 | "test": "standard | snazzy && tap test.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/mcollina/autocannon-compare.git" 15 | }, 16 | "keywords": [ 17 | "autocannon", 18 | "http", 19 | "benchmark", 20 | "soak", 21 | "load", 22 | "compare", 23 | "ttest" 24 | ], 25 | "author": "Matteo Collina ", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/mcollina/autocannon-compare/issues" 29 | }, 30 | "homepage": "https://github.com/mcollina/autocannon-compare#readme", 31 | "devDependencies": { 32 | "pre-commit": "^1.2.2", 33 | "snazzy": "^8.0.0", 34 | "standard": "^12.0.1", 35 | "tap": "^12.0.0" 36 | }, 37 | "dependencies": { 38 | "ttest": "^2.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/summary/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/summary@0.3.2/node_modules/summary/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andreas Madsen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Matteo Collina 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/src/cli.d.ts: -------------------------------------------------------------------------------- 1 | export function bench(name: string, fn: () => any): void; 2 | export function baseline(name: string, fn: () => any): void; 3 | 4 | export function group(fn: () => void): void; 5 | export function group(name: string, fn: () => void): void; 6 | export function group(options: { name?: string, summary?: boolean }, fn: () => void): void; 7 | 8 | export function run(options?: { 9 | avg?: boolean, 10 | colors?: boolean, 11 | min_max?: boolean, 12 | collect?: boolean, 13 | percentiles?: boolean, 14 | json?: number | boolean, 15 | }): Promise; 16 | 17 | export interface Report { 18 | cpu: string; 19 | runtime: string; 20 | 21 | benchmarks: { 22 | name: string; 23 | time: number; 24 | fn: () => any; 25 | async: boolean; 26 | warmup: boolean; 27 | baseline: boolean; 28 | group: string | null; 29 | 30 | error?: { 31 | stack: string; 32 | message: string; 33 | }; 34 | 35 | stats?: { 36 | n: number; 37 | avg: number; 38 | min: number; 39 | max: number; 40 | p75: number; 41 | p99: number; 42 | p995: number; 43 | p999: number; 44 | jit: number[]; 45 | }; 46 | }[]; 47 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/src/cli.d.ts: -------------------------------------------------------------------------------- 1 | export function bench(name: string, fn: () => any): void; 2 | export function baseline(name: string, fn: () => any): void; 3 | 4 | export function group(fn: () => void): void; 5 | export function group(name: string, fn: () => void): void; 6 | export function group(options: { name?: string, summary?: boolean }, fn: () => void): void; 7 | 8 | export function run(options?: { 9 | avg?: boolean, 10 | colors?: boolean, 11 | min_max?: boolean, 12 | collect?: boolean, 13 | percentiles?: boolean, 14 | json?: number | boolean, 15 | }): Promise; 16 | 17 | export interface Report { 18 | cpu: string; 19 | runtime: string; 20 | 21 | benchmarks: { 22 | name: string; 23 | time: number; 24 | fn: () => any; 25 | async: boolean; 26 | warmup: boolean; 27 | baseline: boolean; 28 | group: string | null; 29 | 30 | error?: { 31 | stack: string; 32 | message: string; 33 | }; 34 | 35 | stats?: { 36 | n: number; 37 | avg: number; 38 | min: number; 39 | max: number; 40 | p75: number; 41 | p99: number; 42 | p995: number; 43 | p999: number; 44 | jit: number[]; 45 | }; 46 | }[]; 47 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/src/time.mjs: -------------------------------------------------------------------------------- 1 | const time = (() => { 2 | const ceil = Math.ceil; 3 | 4 | try { 5 | Bun.nanoseconds(); 6 | 7 | return { 8 | now: Bun.nanoseconds, 9 | diff: (a, b) => a - b, 10 | }; 11 | } catch { } 12 | 13 | try { 14 | process.hrtime.bigint(); 15 | if ('Deno' in globalThis) throw 0; 16 | 17 | return { 18 | now: process.hrtime.bigint, 19 | diff: (a, b) => Number(a - b), 20 | }; 21 | } catch { } 22 | 23 | try { 24 | Deno.core.opSync('op_bench_now'); 25 | 26 | return { 27 | diff: (a, b) => a - b, 28 | now: () => Deno.core.opSync('op_bench_now'), 29 | }; 30 | } catch { } 31 | 32 | try { 33 | Deno.core.opSync('op_now'); 34 | 35 | return { 36 | diff: (a, b) => a - b, 37 | now: () => ceil(1e6 * Deno.core.opSync('op_now')), 38 | }; 39 | } catch { } 40 | 41 | try { 42 | $.agent.monotonicNow(); 43 | 44 | return { 45 | diff: (a, b) => a - b, 46 | now: () => ceil(1e6 * $.agent.monotonicNow()), 47 | }; 48 | } catch {} 49 | 50 | return { 51 | diff: (a, b) => a - b, 52 | now: () => ceil(1e6 * performance.now()), 53 | }; 54 | })(); 55 | 56 | export const now = time.now; 57 | export const diff = time.diff; -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/test/studentt.R: -------------------------------------------------------------------------------- 1 | # This script generates a JSON file with various values of Student's t-distribution. 2 | # The results will be compared with the one's obtained with the JavaScript implementation. 3 | 4 | dfs <- c(1, 2, 2.5, 5, 10, 10.1, 50, 50.1) 5 | ts <- c(-10, -5, -2, -1, -0.5, 0, 0.5, 1, 2, 5, 10) 6 | ps <- c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) 7 | 8 | pdfstr <- ' "pdf": [\n' 9 | for (df in dfs) { 10 | for (t in ts) { 11 | pdfstr <- paste0(pdfstr, sprintf(' [%.2e, %.2e, %.16e],\n', t, df, dt(t, df))) 12 | } 13 | } 14 | pdfstr <- paste0(substring(pdfstr, 1, nchar(pdfstr) - 2), ' \n]') 15 | 16 | cdfstr <- ' "cdf": [\n' 17 | for (df in dfs) { 18 | for (t in ts) { 19 | cdfstr <- paste0(cdfstr, sprintf(' [%.2e, %.2e, %.16e],\n', t, df, pt(t, df))) 20 | } 21 | } 22 | cdfstr <- paste0(substring(cdfstr, 1, nchar(cdfstr) - 2), ' \n]') 23 | 24 | ppfstr <- ' "ppf": [\n' 25 | for (df in dfs) { 26 | for (p in ps) { 27 | ppfstr <- paste0(ppfstr, sprintf(' [%.2e, %.2e, %.16e],\n', p, df, qt(p, df))) 28 | } 29 | } 30 | ppfstr <- paste0(substring(ppfstr, 1, nchar(ppfstr) - 2), ' \n]') 31 | 32 | write(paste0('{\n', pdfstr, ',\n', cdfstr, ',\n', ppfstr, '\n}\n'), file='assets/studentt.json') 33 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/test/async.test.js: -------------------------------------------------------------------------------- 1 | 2 | const test = require('tap').test; 3 | const almostEqual = require("./almost-equal.js"); 4 | const CephesWrapper = require('../cephes-wrapper.js'); 5 | 6 | test("not waiting fails in async mode", function (t) { 7 | const cephes = new CephesWrapper(false); // async mode 8 | 9 | t.throws(() => cephes._cephes_exp(2), 'cephes._cephes_exp is not a function'); 10 | t.end(); 11 | }); 12 | 13 | test("waiting works in async mode", async function (t) { 14 | const cephes = new CephesWrapper(false); // async mode 15 | await cephes.compiled; 16 | 17 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 18 | t.end(); 19 | }); 20 | 21 | test("waiting is optional when in sync mode", async function (t) { 22 | const cephes = new CephesWrapper(true); // sync mode 23 | await cephes.compiled; 24 | 25 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 26 | t.end(); 27 | }); 28 | 29 | test("cephes-browser.js is cephes in async mode", async function (t) { 30 | const cephes = require('../cephes-browser.js'); 31 | t.throws(() => cephes._cephes_exp(2), 'cephes._cephes_exp is not a function'); 32 | 33 | await cephes.compiled; 34 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 35 | t.end(); 36 | }); 37 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/test/studentt.R: -------------------------------------------------------------------------------- 1 | # This script generates a JSON file with various values of Student's t-distribution. 2 | # The results will be compared with the one's obtained with the JavaScript implementation. 3 | 4 | dfs <- c(1, 2, 2.5, 5, 10, 10.1, 50, 50.1) 5 | ts <- c(-10, -5, -2, -1, -0.5, 0, 0.5, 1, 2, 5, 10) 6 | ps <- c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) 7 | 8 | pdfstr <- ' "pdf": [\n' 9 | for (df in dfs) { 10 | for (t in ts) { 11 | pdfstr <- paste0(pdfstr, sprintf(' [%.2e, %.2e, %.16e],\n', t, df, dt(t, df))) 12 | } 13 | } 14 | pdfstr <- paste0(substring(pdfstr, 1, nchar(pdfstr) - 2), ' \n]') 15 | 16 | cdfstr <- ' "cdf": [\n' 17 | for (df in dfs) { 18 | for (t in ts) { 19 | cdfstr <- paste0(cdfstr, sprintf(' [%.2e, %.2e, %.16e],\n', t, df, pt(t, df))) 20 | } 21 | } 22 | cdfstr <- paste0(substring(cdfstr, 1, nchar(cdfstr) - 2), ' \n]') 23 | 24 | ppfstr <- ' "ppf": [\n' 25 | for (df in dfs) { 26 | for (p in ps) { 27 | ppfstr <- paste0(ppfstr, sprintf(' [%.2e, %.2e, %.16e],\n', p, df, qt(p, df))) 28 | } 29 | } 30 | ppfstr <- paste0(substring(ppfstr, 1, nchar(ppfstr) - 2), ' \n]') 31 | 32 | write(paste0('{\n', pdfstr, ',\n', cdfstr, ',\n', ppfstr, '\n}\n'), file='assets/studentt.json') 33 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/test/async.test.js: -------------------------------------------------------------------------------- 1 | 2 | const test = require('tap').test; 3 | const almostEqual = require("./almost-equal.js"); 4 | const CephesWrapper = require('../cephes-wrapper.js'); 5 | 6 | test("not waiting fails in async mode", function (t) { 7 | const cephes = new CephesWrapper(false); // async mode 8 | 9 | t.throws(() => cephes._cephes_exp(2), 'cephes._cephes_exp is not a function'); 10 | t.end(); 11 | }); 12 | 13 | test("waiting works in async mode", async function (t) { 14 | const cephes = new CephesWrapper(false); // async mode 15 | await cephes.compiled; 16 | 17 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 18 | t.end(); 19 | }); 20 | 21 | test("waiting is optional when in sync mode", async function (t) { 22 | const cephes = new CephesWrapper(true); // sync mode 23 | await cephes.compiled; 24 | 25 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 26 | t.end(); 27 | }); 28 | 29 | test("cephes-browser.js is cephes in async mode", async function (t) { 30 | const cephes = require('../cephes-browser.js'); 31 | t.throws(() => cephes._cephes_exp(2), 'cephes._cephes_exp is not a function'); 32 | 33 | await cephes.compiled; 34 | almostEqual(t, cephes._cephes_exp(2), Math.exp(2)); 35 | t.end(); 36 | }); 37 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/src/time.mjs: -------------------------------------------------------------------------------- 1 | const time = (() => { 2 | const ceil = Math.ceil; 3 | 4 | try { 5 | Bun.nanoseconds(); 6 | 7 | return { 8 | now: Bun.nanoseconds, 9 | diff: (a, b) => a - b, 10 | }; 11 | } catch { } 12 | 13 | try { 14 | process.hrtime.bigint(); 15 | if ('Deno' in globalThis) throw 0; 16 | 17 | return { 18 | now: process.hrtime.bigint, 19 | diff: (a, b) => Number(a - b), 20 | }; 21 | } catch { } 22 | 23 | try { 24 | Deno.core.opSync('op_bench_now'); 25 | 26 | return { 27 | diff: (a, b) => a - b, 28 | now: () => Deno.core.opSync('op_bench_now'), 29 | }; 30 | } catch { } 31 | 32 | try { 33 | Deno.core.opSync('op_now'); 34 | 35 | return { 36 | diff: (a, b) => a - b, 37 | now: () => ceil(1e6 * Deno.core.opSync('op_now')), 38 | }; 39 | } catch { } 40 | 41 | try { 42 | $.agent.monotonicNow(); 43 | 44 | return { 45 | diff: (a, b) => a - b, 46 | now: () => ceil(1e6 * $.agent.monotonicNow()), 47 | }; 48 | } catch {} 49 | 50 | return { 51 | diff: (a, b) => a - b, 52 | now: () => ceil(1e6 * performance.now()), 53 | }; 54 | })(); 55 | 56 | export const now = time.now; 57 | export const diff = time.diff; -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/btdtr.c: -------------------------------------------------------------------------------- 1 | 2 | /* btdtr.c 3 | * 4 | * Beta distribution 5 | * 6 | * 7 | * 8 | * SYNOPSIS: 9 | * 10 | * double a, b, x, y, btdtr(); 11 | * 12 | * y = btdtr( a, b, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns the area from zero to x under the beta density 19 | * function: 20 | * 21 | * 22 | * x 23 | * - - 24 | * | (a+b) | | a-1 b-1 25 | * P(x) = ---------- | t (1-t) dt 26 | * - - | | 27 | * | (a) | (b) - 28 | * 0 29 | * 30 | * 31 | * This function is identical to the incomplete beta 32 | * integral function incbet(a, b, x). 33 | * 34 | * The complemented function is 35 | * 36 | * 1 - P(1-x) = incbet( b, a, x ); 37 | * 38 | * 39 | * ACCURACY: 40 | * 41 | * See incbet.c. 42 | * 43 | */ 44 | 45 | /* btdtr() */ 46 | 47 | /* 48 | Cephes Math Library Release 2.8: June, 2000 49 | Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier 50 | */ 51 | #include "mconf.h" 52 | #ifdef ANSIPROT 53 | extern double incbet(double, double, double); 54 | #else 55 | double incbet(); 56 | #endif 57 | 58 | double btdtr(a, b, x) double a, b, x; 59 | { return (incbet(a, b, x)); } 60 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/btdtr.c: -------------------------------------------------------------------------------- 1 | 2 | /* btdtr.c 3 | * 4 | * Beta distribution 5 | * 6 | * 7 | * 8 | * SYNOPSIS: 9 | * 10 | * double a, b, x, y, btdtr(); 11 | * 12 | * y = btdtr( a, b, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns the area from zero to x under the beta density 19 | * function: 20 | * 21 | * 22 | * x 23 | * - - 24 | * | (a+b) | | a-1 b-1 25 | * P(x) = ---------- | t (1-t) dt 26 | * - - | | 27 | * | (a) | (b) - 28 | * 0 29 | * 30 | * 31 | * This function is identical to the incomplete beta 32 | * integral function incbet(a, b, x). 33 | * 34 | * The complemented function is 35 | * 36 | * 1 - P(1-x) = incbet( b, a, x ); 37 | * 38 | * 39 | * ACCURACY: 40 | * 41 | * See incbet.c. 42 | * 43 | */ 44 | 45 | /* btdtr() */ 46 | 47 | /* 48 | Cephes Math Library Release 2.8: June, 2000 49 | Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier 50 | */ 51 | #include "mconf.h" 52 | #ifdef ANSIPROT 53 | extern double incbet(double, double, double); 54 | #else 55 | double incbet(); 56 | #endif 57 | 58 | double btdtr(a, b, x) double a, b, x; 59 | { return (incbet(a, b, x)); } 60 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/tests/test.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | baseline('aaa', () => {}); 5 | bench('noop2', () => Promise.resolve(1)); 6 | 7 | group(() => { 8 | bench('a', () => {}); 9 | bench('b', () => {}); 10 | bench('e', () => { throw 1; }) 11 | }); 12 | 13 | group('group', () => { 14 | baseline('baseline', () => {}); 15 | bench('Date.now()', () => Date.now()); 16 | bench('performance.now()', () => performance.now()); 17 | }); 18 | 19 | group({ summary: false }, () => { 20 | bench('aa', () => {}); 21 | bench('bb', () => {}); 22 | }); 23 | 24 | group({ name: 'group2', summary: false }, () => { 25 | bench('new Array(0)', () => new Array(0)); 26 | bench('new Array(1024)', () => new Array(1024)); 27 | }); 28 | 29 | bench('error', () => { throw new Error('error'); }); 30 | 31 | const report = await run({ 32 | avg: true, // enable/disable avg column (default: true) 33 | json: false, // enable/disable json output (default: false) 34 | colors: true, // enable/disable colors (default: true) 35 | min_max: true, // enable/disable min/max column (default: true) 36 | collect: false, // enable/disable collecting returned values into an array during the benchmark (default: false) 37 | percentiles: false, // enable/disable percentiles column (default: true) 38 | }); -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/tests/test.ts: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | baseline('aaa', () => {}); 5 | bench('noop2', () => Promise.resolve(1)); 6 | 7 | group(() => { 8 | bench('a', () => {}); 9 | bench('b', () => {}); 10 | bench('e', () => { throw 1; }) 11 | }); 12 | 13 | group('group', () => { 14 | baseline('baseline', () => {}); 15 | bench('Date.now()', () => Date.now()); 16 | bench('performance.now()', () => performance.now()); 17 | }); 18 | 19 | group({ summary: false }, () => { 20 | bench('aa', () => {}); 21 | bench('bb', () => {}); 22 | }); 23 | 24 | group({ name: 'group2', summary: false }, () => { 25 | bench('new Array(0)', () => new Array(0)); 26 | bench('new Array(1024)', () => new Array(1024)); 27 | }); 28 | 29 | bench('error', () => { throw new Error('error'); }); 30 | 31 | const report = await run({ 32 | avg: true, // enable/disable avg column (default: true) 33 | json: false, // enable/disable json output (default: false) 34 | colors: true, // enable/disable colors (default: true) 35 | min_max: true, // enable/disable min/max column (default: true) 36 | collect: false, // enable/disable collecting returned values into an array during the benchmark (default: false) 37 | percentiles: false, // enable/disable percentiles column (default: true) 38 | }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/tests/test.js: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | baseline('aaa', () => {}); 5 | bench('noop2', () => Promise.resolve(1)); 6 | 7 | group(() => { 8 | bench('a', () => {}); 9 | bench('b', () => {}); 10 | bench('e', () => { throw 1; }) 11 | }); 12 | 13 | group('group', () => { 14 | baseline('baseline', () => {}); 15 | bench('Date.now()', () => Date.now()); 16 | bench('performance.now()', () => performance.now()); 17 | }); 18 | 19 | group({ summary: false }, () => { 20 | bench('aa', () => {}); 21 | bench('bb', () => {}); 22 | }); 23 | 24 | group({ name: 'group2', summary: false }, () => { 25 | bench('new Array(0)', () => new Array(0)); 26 | bench('new Array(1024)', () => new Array(1024)); 27 | }); 28 | 29 | bench('error', () => { throw new Error('error'); }); 30 | 31 | const report = await run({ 32 | avg: true, // enable/disable avg column (default: true) 33 | json: false, // enable/disable json output (default: false) 34 | colors: true, // enable/disable colors (default: true) 35 | min_max: true, // enable/disable min/max column (default: true) 36 | collect: false, // enable/disable collecting returned values into an array during the benchmark (default: false) 37 | percentiles: false, // enable/disable percentiles column (default: true) 38 | }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/tests/test.ts: -------------------------------------------------------------------------------- 1 | import { run, bench, group, baseline } from '..'; 2 | 3 | bench('noop', () => {}); 4 | baseline('aaa', () => {}); 5 | bench('noop2', () => Promise.resolve(1)); 6 | 7 | group(() => { 8 | bench('a', () => {}); 9 | bench('b', () => {}); 10 | bench('e', () => { throw 1; }) 11 | }); 12 | 13 | group('group', () => { 14 | baseline('baseline', () => {}); 15 | bench('Date.now()', () => Date.now()); 16 | bench('performance.now()', () => performance.now()); 17 | }); 18 | 19 | group({ summary: false }, () => { 20 | bench('aa', () => {}); 21 | bench('bb', () => {}); 22 | }); 23 | 24 | group({ name: 'group2', summary: false }, () => { 25 | bench('new Array(0)', () => new Array(0)); 26 | bench('new Array(1024)', () => new Array(1024)); 27 | }); 28 | 29 | bench('error', () => { throw new Error('error'); }); 30 | 31 | const report = await run({ 32 | avg: true, // enable/disable avg column (default: true) 33 | json: false, // enable/disable json output (default: false) 34 | colors: true, // enable/disable colors (default: true) 35 | min_max: true, // enable/disable min/max column (default: true) 36 | collect: false, // enable/disable collecting returned values into an array during the benchmark (default: false) 37 | percentiles: false, // enable/disable percentiles column (default: true) 38 | }); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/test/simple/errors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const test = require('tap').test; 4 | const ttest = require('../../hypothesis.js'); 5 | 6 | test('throws if left value is not compatible', function (t) { 7 | t.throws(() => ttest('string'), { 8 | message: 'left value in hypothesis test must be an array or data summary' 9 | }); 10 | t.end(); 11 | }); 12 | 13 | test('throws if mu is not a number', function (t) { 14 | t.throws(() => ttest([0, 1, 2], { mu: 'string' }), { 15 | message: 'mu option must be a number' 16 | }); 17 | t.end(); 18 | }); 19 | 20 | test('throws if varEqual is not a boolean', function (t) { 21 | t.throws(() => ttest([0, 1, 2], { varEqual: 'string' }), { 22 | message: 'varEqual option must be a boolean' 23 | }); 24 | t.end(); 25 | }); 26 | 27 | test('throws if alpha is not a number or out of range', function (t) { 28 | t.throws(() => ttest([0, 1, 2], { alpha: 'string' }), { 29 | message: 'alpha option must be a number' 30 | }); 31 | t.throws(() => ttest([0, 1, 2], { alpha: 1 }), { 32 | message: 'alpha must be below 1.0' 33 | }); 34 | t.end(); 35 | }); 36 | 37 | test('throws if alternative is wrong', function (t) { 38 | t.throws(() => ttest([0, 1, 2], { alternative: 'bigger' }), { 39 | message: 'alternative must be either "not equal", "less" or "greater"' 40 | }); 41 | t.end(); 42 | }); 43 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/test/simple/errors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const test = require('tap').test; 4 | const ttest = require('../../hypothesis.js'); 5 | 6 | test('throws if left value is not compatible', function (t) { 7 | t.throws(() => ttest('string'), { 8 | message: 'left value in hypothesis test must be an array or data summary' 9 | }); 10 | t.end(); 11 | }); 12 | 13 | test('throws if mu is not a number', function (t) { 14 | t.throws(() => ttest([0, 1, 2], { mu: 'string' }), { 15 | message: 'mu option must be a number' 16 | }); 17 | t.end(); 18 | }); 19 | 20 | test('throws if varEqual is not a boolean', function (t) { 21 | t.throws(() => ttest([0, 1, 2], { varEqual: 'string' }), { 22 | message: 'varEqual option must be a boolean' 23 | }); 24 | t.end(); 25 | }); 26 | 27 | test('throws if alpha is not a number or out of range', function (t) { 28 | t.throws(() => ttest([0, 1, 2], { alpha: 'string' }), { 29 | message: 'alpha option must be a number' 30 | }); 31 | t.throws(() => ttest([0, 1, 2], { alpha: 1 }), { 32 | message: 'alpha must be below 1.0' 33 | }); 34 | t.end(); 35 | }); 36 | 37 | test('throws if alternative is wrong', function (t) { 38 | t.throws(() => ttest([0, 1, 2], { alternative: 'bigger' }), { 39 | message: 'alternative must be either "not equal", "less" or "greater"' 40 | }); 41 | t.end(); 42 | }); 43 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/test/equal.js: -------------------------------------------------------------------------------- 1 | 2 | function absoluteEqual(s) { 3 | for (var i = 0, l = s.map.length; i < l; i++) { 4 | var args = s.map[i].slice(0, -1); 5 | var last = s.map[i][ s.map[i].length - 1 ]; 6 | var ret = s.fn.apply(null, args); 7 | 8 | if (Number.isFinite(last)) { 9 | s.test.ok( 10 | Math.abs(ret - last) < s.limit, 11 | `is ${ret} almost absolute equal ${last}` 12 | ); 13 | } else { 14 | s.test.ok( 15 | Object.is(ret, last), 16 | `is ${ret} equal ${last}` 17 | ); 18 | } 19 | } 20 | } 21 | exports.absoluteEqual = absoluteEqual; 22 | 23 | function relativeEqual(s) { 24 | for (var i = 0, l = s.map.length; i < l; i++) { 25 | var args = s.map[i].slice(0, -1); 26 | var last = s.map[i][ s.map[i].length - 1 ]; 27 | 28 | if (Number.isFinite(last)) { 29 | if (last === 0) { 30 | s.test.ok( 31 | Math.abs( s.fn.apply(null, args) - last) < s.limit, 32 | 'almost absolute equal' 33 | ); 34 | } else { 35 | s.test.ok( 36 | Math.abs( s.fn.apply(null, args) - last ) / last < s.limit, 37 | 'almost relative equal' 38 | ); 39 | } 40 | } else { 41 | s.test.ok( 42 | Object.is(s.fn.apply(null, args), last), 43 | 'exact equal' 44 | ); 45 | } 46 | } 47 | } 48 | exports.relativeEqual = relativeEqual; 49 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/test/equal.js: -------------------------------------------------------------------------------- 1 | 2 | function absoluteEqual(s) { 3 | for (var i = 0, l = s.map.length; i < l; i++) { 4 | var args = s.map[i].slice(0, -1); 5 | var last = s.map[i][ s.map[i].length - 1 ]; 6 | var ret = s.fn.apply(null, args); 7 | 8 | if (Number.isFinite(last)) { 9 | s.test.ok( 10 | Math.abs(ret - last) < s.limit, 11 | `is ${ret} almost absolute equal ${last}` 12 | ); 13 | } else { 14 | s.test.ok( 15 | Object.is(ret, last), 16 | `is ${ret} equal ${last}` 17 | ); 18 | } 19 | } 20 | } 21 | exports.absoluteEqual = absoluteEqual; 22 | 23 | function relativeEqual(s) { 24 | for (var i = 0, l = s.map.length; i < l; i++) { 25 | var args = s.map[i].slice(0, -1); 26 | var last = s.map[i][ s.map[i].length - 1 ]; 27 | 28 | if (Number.isFinite(last)) { 29 | if (last === 0) { 30 | s.test.ok( 31 | Math.abs( s.fn.apply(null, args) - last) < s.limit, 32 | 'almost absolute equal' 33 | ); 34 | } else { 35 | s.test.ok( 36 | Math.abs( s.fn.apply(null, args) - last ) / last < s.limit, 37 | 'almost relative equal' 38 | ); 39 | } 40 | } else { 41 | s.test.ok( 42 | Object.is(s.fn.apply(null, args), last), 43 | 'exact equal' 44 | ); 45 | } 46 | } 47 | } 48 | exports.relativeEqual = relativeEqual; 49 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/round.c: -------------------------------------------------------------------------------- 1 | /* round.c 2 | * 3 | * Round double to nearest or even integer valued double 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, round(); 10 | * 11 | * y = round(x); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns the nearest integer to x as a double precision 18 | * floating point result. If x ends in 0.5 exactly, the 19 | * nearest even integer is chosen. 20 | * 21 | * 22 | * 23 | * ACCURACY: 24 | * 25 | * If x is greater than 1/(2*MACHEP), its closest machine 26 | * representation is already an integer, so rounding does 27 | * not change it. 28 | */ 29 | 30 | /* 31 | Cephes Math Library Release 2.1: January, 1989 32 | Copyright 1984, 1987, 1989 by Stephen L. Moshier 33 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 34 | */ 35 | #include "mconf.h" 36 | #ifdef ANSIPROT 37 | double floor(double); 38 | #else 39 | double floor(); 40 | #endif 41 | 42 | double round(x) double x; 43 | { 44 | double y, r; 45 | 46 | /* Largest integer <= x */ 47 | y = floor(x); 48 | 49 | /* Fractional part */ 50 | r = x - y; 51 | 52 | /* Round up to nearest. */ 53 | if (r > 0.5) 54 | goto rndup; 55 | 56 | /* Round to even */ 57 | if (r == 0.5) { 58 | r = y - 2.0 * floor(0.5 * y); 59 | if (r == 1.0) { 60 | rndup: 61 | y += 1.0; 62 | } 63 | } 64 | 65 | /* Else round down. */ 66 | return (y); 67 | } 68 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/round.c: -------------------------------------------------------------------------------- 1 | /* round.c 2 | * 3 | * Round double to nearest or even integer valued double 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, round(); 10 | * 11 | * y = round(x); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns the nearest integer to x as a double precision 18 | * floating point result. If x ends in 0.5 exactly, the 19 | * nearest even integer is chosen. 20 | * 21 | * 22 | * 23 | * ACCURACY: 24 | * 25 | * If x is greater than 1/(2*MACHEP), its closest machine 26 | * representation is already an integer, so rounding does 27 | * not change it. 28 | */ 29 | 30 | /* 31 | Cephes Math Library Release 2.1: January, 1989 32 | Copyright 1984, 1987, 1989 by Stephen L. Moshier 33 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 34 | */ 35 | #include "mconf.h" 36 | #ifdef ANSIPROT 37 | double floor(double); 38 | #else 39 | double floor(); 40 | #endif 41 | 42 | double round(x) double x; 43 | { 44 | double y, r; 45 | 46 | /* Largest integer <= x */ 47 | y = floor(x); 48 | 49 | /* Fractional part */ 50 | r = x - y; 51 | 52 | /* Round up to nearest. */ 53 | if (r > 0.5) 54 | goto rndup; 55 | 56 | /* Round to even */ 57 | if (r == 0.5) { 58 | r = y - 2.0 * floor(0.5 * y); 59 | if (r == 1.0) { 60 | rndup: 61 | y += 1.0; 62 | } 63 | } 64 | 65 | /* Else round down. */ 66 | return (y); 67 | } 68 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/test/simple/studentt.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var distributions = require('../../distributions.js'); 4 | var equals = require('../equal.js'); 5 | 6 | var reference = require('../assets/studentt.json'); 7 | 8 | test('testing student t density function', function (t) { 9 | equals.absoluteEqual({ 10 | test: t, 11 | map: reference.pdf, 12 | fn: (t, df) => distributions.Studentt(df).pdf(t), 13 | limit: 0.0000005 14 | }); 15 | 16 | t.end(); 17 | }); 18 | 19 | test('testing student t cumulative function', function (t) { 20 | equals.absoluteEqual({ 21 | test: t, 22 | map: reference.cdf, 23 | fn: (t, df) => distributions.Studentt(df).cdf(t), 24 | limit: 0.0000005 25 | }); 26 | 27 | t.end(); 28 | }); 29 | 30 | test('testing student t inverse function', function (t) { 31 | equals.absoluteEqual({ 32 | test: t, 33 | map: reference.ppf, 34 | fn: (p, df) => distributions.Studentt(df).inv(p), 35 | limit: 0.0000005 36 | }); 37 | 38 | equals.absoluteEqual({ 39 | test: t, 40 | map: [ 41 | [0.0, 15, -Infinity], 42 | [1.0, 15, +Infinity] 43 | ], 44 | fn: (p, df) => distributions.Studentt(df).inv(p), 45 | limit: 0.0000005 46 | }); 47 | 48 | t.end(); 49 | }); 50 | 51 | test('testing student t key values', function (t) { 52 | var studentt = distributions.Studentt(15); 53 | 54 | t.equal(studentt.median(), 0); 55 | t.equal(studentt.mean(), 0); 56 | t.equal(studentt.variance(), 15/13); 57 | 58 | t.end(); 59 | }); 60 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/test/simple/studentt.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var distributions = require('../../distributions.js'); 4 | var equals = require('../equal.js'); 5 | 6 | var reference = require('../assets/studentt.json'); 7 | 8 | test('testing student t density function', function (t) { 9 | equals.absoluteEqual({ 10 | test: t, 11 | map: reference.pdf, 12 | fn: (t, df) => distributions.Studentt(df).pdf(t), 13 | limit: 0.0000005 14 | }); 15 | 16 | t.end(); 17 | }); 18 | 19 | test('testing student t cumulative function', function (t) { 20 | equals.absoluteEqual({ 21 | test: t, 22 | map: reference.cdf, 23 | fn: (t, df) => distributions.Studentt(df).cdf(t), 24 | limit: 0.0000005 25 | }); 26 | 27 | t.end(); 28 | }); 29 | 30 | test('testing student t inverse function', function (t) { 31 | equals.absoluteEqual({ 32 | test: t, 33 | map: reference.ppf, 34 | fn: (p, df) => distributions.Studentt(df).inv(p), 35 | limit: 0.0000005 36 | }); 37 | 38 | equals.absoluteEqual({ 39 | test: t, 40 | map: [ 41 | [0.0, 15, -Infinity], 42 | [1.0, 15, +Infinity] 43 | ], 44 | fn: (p, df) => distributions.Studentt(df).inv(p), 45 | limit: 0.0000005 46 | }); 47 | 48 | t.end(); 49 | }); 50 | 51 | test('testing student t key values', function (t) { 52 | var studentt = distributions.Studentt(15); 53 | 54 | t.equal(studentt.median(), 0); 55 | t.equal(studentt.mean(), 0); 56 | t.equal(studentt.variance(), 15/13); 57 | 58 | t.end(); 59 | }); 60 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/distributions/normal.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function NormalDistribution(mean, sd) { 5 | if (!(this instanceof NormalDistribution)) { 6 | return new NormalDistribution(mean, sd); 7 | } 8 | 9 | if (typeof mean !== 'number' && mean !== undefined) { 10 | throw TypeError('mean must be a number'); 11 | } 12 | if (typeof sd !== 'number' && sd !== undefined) { 13 | throw TypeError('sd must be a number'); 14 | } 15 | 16 | if (sd !== undefined && sd <= 0.0) { 17 | throw TypeError('sd must be positive'); 18 | } 19 | 20 | this._mean = mean || 0; 21 | this._sd = sd || 1; 22 | this._var = this._sd * this._sd; 23 | } 24 | module.exports = NormalDistribution; 25 | 26 | // -0.5 * log(2 Pi) 27 | var HALF_TWO_PI_LOG = -0.91893853320467274180; 28 | 29 | NormalDistribution.prototype.pdf = function (x) { 30 | return Math.exp(HALF_TWO_PI_LOG - Math.log(this._sd) - Math.pow(x - this._mean, 2) / (2 * this._var)); 31 | }; 32 | 33 | NormalDistribution.prototype.cdf = function (x) { 34 | return cephes.ndtr((x - this._mean) / this._sd); 35 | }; 36 | 37 | NormalDistribution.prototype.inv = function (p) { 38 | if (p <= 0) return -Infinity; 39 | if (p >= 1) return Infinity; 40 | return this._sd * cephes.ndtri(p) + this._mean; 41 | }; 42 | 43 | NormalDistribution.prototype.median = function () { 44 | return this._mean; 45 | }; 46 | 47 | NormalDistribution.prototype.mean = function () { 48 | return this._mean; 49 | }; 50 | 51 | NormalDistribution.prototype.variance = function () { 52 | return this._var; 53 | }; 54 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/distributions/uniform.js: -------------------------------------------------------------------------------- 1 | 2 | function UniformDistribution(a, b) { 3 | if (!(this instanceof UniformDistribution)) { 4 | return new UniformDistribution(a, b); 5 | } 6 | 7 | if (typeof a !== 'number' && a !== undefined) { 8 | throw TypeError('mean must be a number'); 9 | } 10 | if (typeof b !== 'number' && b !== undefined) { 11 | throw TypeError('sd must be a number'); 12 | } 13 | 14 | this._a = typeof a === 'number' ? a : 0; 15 | this._b = typeof b === 'number' ? b : 1; 16 | 17 | if (this._b <= this._a) { 18 | throw new RangeError('a must be greater than b'); 19 | } 20 | 21 | this._k = 1 / (this._b - this._a); 22 | this._mean = (this._a + this._b) / 2; 23 | this._var = (this._a - this._b) * (this._a - this._b) / 12; 24 | } 25 | module.exports = UniformDistribution; 26 | 27 | UniformDistribution.prototype.pdf = function (x) { 28 | return (x < this._a || x > this._b) ? 0 : this._k; 29 | }; 30 | 31 | UniformDistribution.prototype.cdf = function (x) { 32 | if (x < this._a) return 0; 33 | else if (x > this._b) return 1; 34 | else return (x - this._a) * this._k; 35 | }; 36 | 37 | UniformDistribution.prototype.inv = function (p) { 38 | if (p < 0 || p > 1) return NaN; 39 | else return p * (this._b - this._a) + this._a; 40 | }; 41 | 42 | UniformDistribution.prototype.median = function () { 43 | return this._mean; 44 | }; 45 | 46 | UniformDistribution.prototype.mean = function () { 47 | return this._mean; 48 | }; 49 | 50 | UniformDistribution.prototype.variance = function () { 51 | return this._var; 52 | }; 53 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/distributions/normal.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function NormalDistribution(mean, sd) { 5 | if (!(this instanceof NormalDistribution)) { 6 | return new NormalDistribution(mean, sd); 7 | } 8 | 9 | if (typeof mean !== 'number' && mean !== undefined) { 10 | throw TypeError('mean must be a number'); 11 | } 12 | if (typeof sd !== 'number' && sd !== undefined) { 13 | throw TypeError('sd must be a number'); 14 | } 15 | 16 | if (sd !== undefined && sd <= 0.0) { 17 | throw TypeError('sd must be positive'); 18 | } 19 | 20 | this._mean = mean || 0; 21 | this._sd = sd || 1; 22 | this._var = this._sd * this._sd; 23 | } 24 | module.exports = NormalDistribution; 25 | 26 | // -0.5 * log(2 Pi) 27 | var HALF_TWO_PI_LOG = -0.91893853320467274180; 28 | 29 | NormalDistribution.prototype.pdf = function (x) { 30 | return Math.exp(HALF_TWO_PI_LOG - Math.log(this._sd) - Math.pow(x - this._mean, 2) / (2 * this._var)); 31 | }; 32 | 33 | NormalDistribution.prototype.cdf = function (x) { 34 | return cephes.ndtr((x - this._mean) / this._sd); 35 | }; 36 | 37 | NormalDistribution.prototype.inv = function (p) { 38 | if (p <= 0) return -Infinity; 39 | if (p >= 1) return Infinity; 40 | return this._sd * cephes.ndtri(p) + this._mean; 41 | }; 42 | 43 | NormalDistribution.prototype.median = function () { 44 | return this._mean; 45 | }; 46 | 47 | NormalDistribution.prototype.mean = function () { 48 | return this._mean; 49 | }; 50 | 51 | NormalDistribution.prototype.variance = function () { 52 | return this._var; 53 | }; 54 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/distributions/uniform.js: -------------------------------------------------------------------------------- 1 | 2 | function UniformDistribution(a, b) { 3 | if (!(this instanceof UniformDistribution)) { 4 | return new UniformDistribution(a, b); 5 | } 6 | 7 | if (typeof a !== 'number' && a !== undefined) { 8 | throw TypeError('mean must be a number'); 9 | } 10 | if (typeof b !== 'number' && b !== undefined) { 11 | throw TypeError('sd must be a number'); 12 | } 13 | 14 | this._a = typeof a === 'number' ? a : 0; 15 | this._b = typeof b === 'number' ? b : 1; 16 | 17 | if (this._b <= this._a) { 18 | throw new RangeError('a must be greater than b'); 19 | } 20 | 21 | this._k = 1 / (this._b - this._a); 22 | this._mean = (this._a + this._b) / 2; 23 | this._var = (this._a - this._b) * (this._a - this._b) / 12; 24 | } 25 | module.exports = UniformDistribution; 26 | 27 | UniformDistribution.prototype.pdf = function (x) { 28 | return (x < this._a || x > this._b) ? 0 : this._k; 29 | }; 30 | 31 | UniformDistribution.prototype.cdf = function (x) { 32 | if (x < this._a) return 0; 33 | else if (x > this._b) return 1; 34 | else return (x - this._a) * this._k; 35 | }; 36 | 37 | UniformDistribution.prototype.inv = function (p) { 38 | if (p < 0 || p > 1) return NaN; 39 | else return p * (this._b - this._a) + this._a; 40 | }; 41 | 42 | UniformDistribution.prototype.median = function () { 43 | return this._mean; 44 | }; 45 | 46 | UniformDistribution.prototype.mean = function () { 47 | return this._mean; 48 | }; 49 | 50 | UniformDistribution.prototype.variance = function () { 51 | return this._var; 52 | }; 53 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/test/simple/binomial.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var distributions = require('../../distributions.js'); 4 | var equals = require('../equal.js'); 5 | 6 | test('testing binomial density function', function (t) { 7 | var binomial = distributions.Binomial(0.4, 100); 8 | 9 | var c = [ 10 | [0, 6.533186e-23], 11 | [10 , 1.961179e-11], 12 | [30, 1.000750e-02], 13 | [40, 8.121914e-02], 14 | [50, 1.033751e-02], 15 | [60, 2.442492e-05], 16 | [70, 9.050560e-10], 17 | [100, 1.606938e-40] 18 | ]; 19 | 20 | equals.absoluteEqual({ 21 | test: t, 22 | map: c, 23 | fn: binomial.pdf.bind(binomial), 24 | limit: 0.0000005 25 | }); 26 | 27 | t.end(); 28 | }); 29 | 30 | test('testing none standard binomial cumulative function', function (t) { 31 | var binomial = distributions.Binomial(0.4, 100); 32 | 33 | var c = [ 34 | [0, 6.533186e-23], 35 | [10, 2.338762e-11], 36 | [30, 2.478282e-02], 37 | [40, 5.432945e-01], 38 | [50, 9.832383e-01], 39 | [60, 9.999820e-01], 40 | [70, 1.000000e+00], 41 | [100, 1.000000e+00] 42 | ]; 43 | 44 | equals.absoluteEqual({ 45 | test: t, 46 | map: c, 47 | fn: binomial.cdf.bind(binomial), 48 | limit: 0.0000005 49 | }); 50 | 51 | t.end(); 52 | }); 53 | 54 | test('testing node standard binomial key values', function (t) { 55 | var binomial = distributions.Binomial(0.4, 100); 56 | 57 | t.equal(binomial.median(), 40); 58 | t.equal(binomial.mean(), 40); 59 | t.equal(binomial.variance(), 24); 60 | 61 | t.end(); 62 | }); 63 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/test/simple/binomial.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var distributions = require('../../distributions.js'); 4 | var equals = require('../equal.js'); 5 | 6 | test('testing binomial density function', function (t) { 7 | var binomial = distributions.Binomial(0.4, 100); 8 | 9 | var c = [ 10 | [0, 6.533186e-23], 11 | [10 , 1.961179e-11], 12 | [30, 1.000750e-02], 13 | [40, 8.121914e-02], 14 | [50, 1.033751e-02], 15 | [60, 2.442492e-05], 16 | [70, 9.050560e-10], 17 | [100, 1.606938e-40] 18 | ]; 19 | 20 | equals.absoluteEqual({ 21 | test: t, 22 | map: c, 23 | fn: binomial.pdf.bind(binomial), 24 | limit: 0.0000005 25 | }); 26 | 27 | t.end(); 28 | }); 29 | 30 | test('testing none standard binomial cumulative function', function (t) { 31 | var binomial = distributions.Binomial(0.4, 100); 32 | 33 | var c = [ 34 | [0, 6.533186e-23], 35 | [10, 2.338762e-11], 36 | [30, 2.478282e-02], 37 | [40, 5.432945e-01], 38 | [50, 9.832383e-01], 39 | [60, 9.999820e-01], 40 | [70, 1.000000e+00], 41 | [100, 1.000000e+00] 42 | ]; 43 | 44 | equals.absoluteEqual({ 45 | test: t, 46 | map: c, 47 | fn: binomial.cdf.bind(binomial), 48 | limit: 0.0000005 49 | }); 50 | 51 | t.end(); 52 | }); 53 | 54 | test('testing node standard binomial key values', function (t) { 55 | var binomial = distributions.Binomial(0.4, 100); 56 | 57 | t.equal(binomial.median(), 40); 58 | t.equal(binomial.mean(), 40); 59 | t.equal(binomial.variance(), 24); 60 | 61 | t.end(); 62 | }); 63 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/hypothesis/abstact.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function AbstactStudentT(options) { 4 | this._options = options; 5 | } 6 | module.exports = AbstactStudentT; 7 | 8 | AbstactStudentT.prototype.testValue = function () { 9 | const diff = (this._mean - this._options.mu); 10 | return diff / this._se; 11 | }; 12 | 13 | // Use cdf(-t) instead of 1 - cdf(t), and cdf(-|t|) instead of 1 - cdf(|t|) 14 | // to avoid a numerical error when computing 1 - epsilon. 15 | AbstactStudentT.prototype.pValue = function () { 16 | const t = this.testValue(); 17 | 18 | switch (this._options.alternative) { 19 | case 1: // mu > mu[0] 20 | return this._dist.cdf(-t); 21 | case -1: // mu < mu[0] 22 | return this._dist.cdf(t); 23 | case 0: // mu != mu[0] 24 | return 2 * (this._dist.cdf(-Math.abs(t))); 25 | } 26 | }; 27 | 28 | AbstactStudentT.prototype.confidence = function () { 29 | let pm; 30 | switch (this._options.alternative) { 31 | case 1: // mu > mu[0] 32 | pm = Math.abs(this._dist.inv(this._options.alpha)) * this._se; 33 | return [this._mean - pm, Infinity]; 34 | case -1: // mu < mu[0] 35 | pm = Math.abs(this._dist.inv(this._options.alpha)) * this._se; 36 | return [-Infinity, this._mean + pm]; 37 | case 0: // mu != mu[0] 38 | pm = Math.abs(this._dist.inv(this._options.alpha / 2)) * this._se; 39 | return [this._mean - pm, this._mean + pm]; 40 | } 41 | }; 42 | 43 | AbstactStudentT.prototype.valid = function () { 44 | return this.pValue() >= this._options.alpha; 45 | }; 46 | 47 | AbstactStudentT.prototype.freedom = function () { 48 | return this._df; 49 | } 50 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/hypothesis/abstact.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function AbstactStudentT(options) { 4 | this._options = options; 5 | } 6 | module.exports = AbstactStudentT; 7 | 8 | AbstactStudentT.prototype.testValue = function () { 9 | const diff = (this._mean - this._options.mu); 10 | return diff / this._se; 11 | }; 12 | 13 | // Use cdf(-t) instead of 1 - cdf(t), and cdf(-|t|) instead of 1 - cdf(|t|) 14 | // to avoid a numerical error when computing 1 - epsilon. 15 | AbstactStudentT.prototype.pValue = function () { 16 | const t = this.testValue(); 17 | 18 | switch (this._options.alternative) { 19 | case 1: // mu > mu[0] 20 | return this._dist.cdf(-t); 21 | case -1: // mu < mu[0] 22 | return this._dist.cdf(t); 23 | case 0: // mu != mu[0] 24 | return 2 * (this._dist.cdf(-Math.abs(t))); 25 | } 26 | }; 27 | 28 | AbstactStudentT.prototype.confidence = function () { 29 | let pm; 30 | switch (this._options.alternative) { 31 | case 1: // mu > mu[0] 32 | pm = Math.abs(this._dist.inv(this._options.alpha)) * this._se; 33 | return [this._mean - pm, Infinity]; 34 | case -1: // mu < mu[0] 35 | pm = Math.abs(this._dist.inv(this._options.alpha)) * this._se; 36 | return [-Infinity, this._mean + pm]; 37 | case 0: // mu != mu[0] 38 | pm = Math.abs(this._dist.inv(this._options.alpha / 2)) * this._se; 39 | return [this._mean - pm, this._mean + pm]; 40 | } 41 | }; 42 | 43 | AbstactStudentT.prototype.valid = function () { 44 | return this.pValue() >= this._options.alpha; 45 | }; 46 | 47 | AbstactStudentT.prototype.freedom = function () { 48 | return this._df; 49 | } 50 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/article/main.js: -------------------------------------------------------------------------------- 1 | 2 | const cephes = require('../'); 3 | const d3 = require('./d3.js'); 4 | 5 | const LazyGraphs = require('./lib/lazy-graphs.js'); 6 | const Walkthrough = require('./lib/walkthrough.js'); 7 | const LineGraph = require('./lib/line-graph.js'); 8 | 9 | const colors = d3.schemeCategory10; 10 | 11 | async function setupDiagram() { 12 | const graphs = new LazyGraphs(); 13 | const walkthrough = new Walkthrough({ 14 | container: document.querySelector('#ar-walkthrough') 15 | }); 16 | const lineGraph = new LineGraph({ 17 | container: document.querySelector('#ar-line-graph'), 18 | height: 400, 19 | colors: colors 20 | }); 21 | 22 | walkthrough.select(1); 23 | lineGraph.setData(graphs.get(1)); 24 | lineGraph.draw(); 25 | walkthrough.draw(); 26 | 27 | walkthrough.on('click', function (pageNumber) { 28 | walkthrough.select(pageNumber); 29 | lineGraph.setData(graphs.get(pageNumber)); 30 | walkthrough.draw(); 31 | lineGraph.draw(); 32 | }); 33 | 34 | window.addEventListener('resize', function () { 35 | lineGraph.resize(); 36 | }); 37 | } 38 | 39 | async function main() { 40 | // Render LaTeX elements first, as their size is unknown. 41 | var elements = document.querySelectorAll('math-latex'); 42 | Array.from(elements).forEach(function processElement(element) { 43 | window.katex.render(element.getAttribute('latex'), element, { 44 | displayMode: element.hasAttribute('display-mode') 45 | }); 46 | }); 47 | 48 | await cephes.compiled; 49 | await setupDiagram(); 50 | } 51 | 52 | document.addEventListener('DOMContentLoaded', main); 53 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/article/main.js: -------------------------------------------------------------------------------- 1 | 2 | const cephes = require('../'); 3 | const d3 = require('./d3.js'); 4 | 5 | const LazyGraphs = require('./lib/lazy-graphs.js'); 6 | const Walkthrough = require('./lib/walkthrough.js'); 7 | const LineGraph = require('./lib/line-graph.js'); 8 | 9 | const colors = d3.schemeCategory10; 10 | 11 | async function setupDiagram() { 12 | const graphs = new LazyGraphs(); 13 | const walkthrough = new Walkthrough({ 14 | container: document.querySelector('#ar-walkthrough') 15 | }); 16 | const lineGraph = new LineGraph({ 17 | container: document.querySelector('#ar-line-graph'), 18 | height: 400, 19 | colors: colors 20 | }); 21 | 22 | walkthrough.select(1); 23 | lineGraph.setData(graphs.get(1)); 24 | lineGraph.draw(); 25 | walkthrough.draw(); 26 | 27 | walkthrough.on('click', function (pageNumber) { 28 | walkthrough.select(pageNumber); 29 | lineGraph.setData(graphs.get(pageNumber)); 30 | walkthrough.draw(); 31 | lineGraph.draw(); 32 | }); 33 | 34 | window.addEventListener('resize', function () { 35 | lineGraph.resize(); 36 | }); 37 | } 38 | 39 | async function main() { 40 | // Render LaTeX elements first, as their size is unknown. 41 | var elements = document.querySelectorAll('math-latex'); 42 | Array.from(elements).forEach(function processElement(element) { 43 | window.katex.render(element.getAttribute('latex'), element, { 44 | displayMode: element.hasAttribute('display-mode') 45 | }); 46 | }); 47 | 48 | await cephes.compiled; 49 | await setupDiagram(); 50 | } 51 | 52 | document.addEventListener('DOMContentLoaded', main); 53 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/cosh.c: -------------------------------------------------------------------------------- 1 | /* cosh.c 2 | * 3 | * Hyperbolic cosine 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, cosh(); 10 | * 11 | * y = cosh( x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns hyperbolic cosine of argument in the range MINLOG to 18 | * MAXLOG. 19 | * 20 | * cosh(x) = ( exp(x) + exp(-x) )/2. 21 | * 22 | * 23 | * 24 | * ACCURACY: 25 | * 26 | * Relative error: 27 | * arithmetic domain # trials peak rms 28 | * DEC +- 88 50000 4.0e-17 7.7e-18 29 | * IEEE +-MAXLOG 30000 2.6e-16 5.7e-17 30 | * 31 | * 32 | * ERROR MESSAGES: 33 | * 34 | * message condition value returned 35 | * cosh overflow |x| > MAXLOG MAXNUM 36 | * 37 | * 38 | */ 39 | 40 | /* cosh.c */ 41 | 42 | /* 43 | Cephes Math Library Release 2.8: June, 2000 44 | Copyright 1985, 1995, 2000 by Stephen L. Moshier 45 | */ 46 | 47 | #include "mconf.h" 48 | #ifdef ANSIPROT 49 | extern double exp(double); 50 | extern int isnan(double); 51 | extern int isfinite(double); 52 | #else 53 | double exp(); 54 | int isnan(), isfinite(); 55 | #endif 56 | extern double MAXLOG, INFINITY, LOGE2; 57 | 58 | double cosh(x) double x; 59 | { 60 | double y; 61 | 62 | #ifdef NANS 63 | if (isnan(x)) 64 | return (x); 65 | #endif 66 | if (x < 0) 67 | x = -x; 68 | if (x > (MAXLOG + LOGE2)) { 69 | mtherr("cosh", OVERFLOW); 70 | return (INFINITY); 71 | } 72 | if (x >= (MAXLOG - LOGE2)) { 73 | y = exp(0.5 * x); 74 | y = (0.5 * y) * y; 75 | return (y); 76 | } 77 | y = exp(x); 78 | y = 0.5 * (y + 1.0 / y); 79 | return (y); 80 | } 81 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/cosh.c: -------------------------------------------------------------------------------- 1 | /* cosh.c 2 | * 3 | * Hyperbolic cosine 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, cosh(); 10 | * 11 | * y = cosh( x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns hyperbolic cosine of argument in the range MINLOG to 18 | * MAXLOG. 19 | * 20 | * cosh(x) = ( exp(x) + exp(-x) )/2. 21 | * 22 | * 23 | * 24 | * ACCURACY: 25 | * 26 | * Relative error: 27 | * arithmetic domain # trials peak rms 28 | * DEC +- 88 50000 4.0e-17 7.7e-18 29 | * IEEE +-MAXLOG 30000 2.6e-16 5.7e-17 30 | * 31 | * 32 | * ERROR MESSAGES: 33 | * 34 | * message condition value returned 35 | * cosh overflow |x| > MAXLOG MAXNUM 36 | * 37 | * 38 | */ 39 | 40 | /* cosh.c */ 41 | 42 | /* 43 | Cephes Math Library Release 2.8: June, 2000 44 | Copyright 1985, 1995, 2000 by Stephen L. Moshier 45 | */ 46 | 47 | #include "mconf.h" 48 | #ifdef ANSIPROT 49 | extern double exp(double); 50 | extern int isnan(double); 51 | extern int isfinite(double); 52 | #else 53 | double exp(); 54 | int isnan(), isfinite(); 55 | #endif 56 | extern double MAXLOG, INFINITY, LOGE2; 57 | 58 | double cosh(x) double x; 59 | { 60 | double y; 61 | 62 | #ifdef NANS 63 | if (isnan(x)) 64 | return (x); 65 | #endif 66 | if (x < 0) 67 | x = -x; 68 | if (x > (MAXLOG + LOGE2)) { 69 | mtherr("cosh", OVERFLOW); 70 | return (INFINITY); 71 | } 72 | if (x >= (MAXLOG - LOGE2)) { 73 | y = exp(0.5 * x); 74 | y = (0.5 * y) * y; 75 | return (y); 76 | } 77 | y = exp(x); 78 | y = 0.5 * (y + 1.0 / y); 79 | return (y); 80 | } 81 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/distributions/binomial.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function BinomialDistribution(properbility, size) { 5 | if (!(this instanceof BinomialDistribution)) { 6 | return new BinomialDistribution(properbility, size); 7 | } 8 | 9 | if (typeof properbility !== 'number') { 10 | throw TypeError('properbility must be a number'); 11 | } 12 | if (typeof size !== 'number') { 13 | throw TypeError('size must be a number'); 14 | } 15 | 16 | if (size <= 0.0) { 17 | throw TypeError('size must be positive'); 18 | } 19 | if (properbility < 0.0 || properbility > 1) { 20 | throw TypeError('properbility must be between 0 and 1'); 21 | } 22 | 23 | this._properbility = properbility; 24 | this._size = size; 25 | } 26 | module.exports = BinomialDistribution; 27 | 28 | BinomialDistribution.prototype.pdf = function (x) { 29 | var n = this._size; 30 | var p = this._properbility; 31 | 32 | // choose(n, x) 33 | var binomialCoefficent = cephes.gamma(n + 1) / ( 34 | cephes.gamma(x + 1) * cephes.gamma(n - x + 1) 35 | ) 36 | 37 | return binomialCoefficent * Math.pow(p, x) * Math.pow(1 - p, n - x); 38 | }; 39 | 40 | BinomialDistribution.prototype.cdf = function (x) { 41 | return cephes.bdtr(x, this._size, this._properbility); 42 | }; 43 | 44 | BinomialDistribution.prototype.inv = function (p) { 45 | throw new Error('Inverse CDF of binomial distribution is not implemented'); 46 | }; 47 | 48 | BinomialDistribution.prototype.median = function () { 49 | return Math.round(this._properbility * this._size); 50 | }; 51 | 52 | BinomialDistribution.prototype.mean = function () { 53 | return this._properbility * this._size; 54 | }; 55 | 56 | BinomialDistribution.prototype.variance = function () { 57 | return this._properbility * this._size * (1 - this._properbility); 58 | }; 59 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/distributions/binomial.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function BinomialDistribution(properbility, size) { 5 | if (!(this instanceof BinomialDistribution)) { 6 | return new BinomialDistribution(properbility, size); 7 | } 8 | 9 | if (typeof properbility !== 'number') { 10 | throw TypeError('properbility must be a number'); 11 | } 12 | if (typeof size !== 'number') { 13 | throw TypeError('size must be a number'); 14 | } 15 | 16 | if (size <= 0.0) { 17 | throw TypeError('size must be positive'); 18 | } 19 | if (properbility < 0.0 || properbility > 1) { 20 | throw TypeError('properbility must be between 0 and 1'); 21 | } 22 | 23 | this._properbility = properbility; 24 | this._size = size; 25 | } 26 | module.exports = BinomialDistribution; 27 | 28 | BinomialDistribution.prototype.pdf = function (x) { 29 | var n = this._size; 30 | var p = this._properbility; 31 | 32 | // choose(n, x) 33 | var binomialCoefficent = cephes.gamma(n + 1) / ( 34 | cephes.gamma(x + 1) * cephes.gamma(n - x + 1) 35 | ) 36 | 37 | return binomialCoefficent * Math.pow(p, x) * Math.pow(1 - p, n - x); 38 | }; 39 | 40 | BinomialDistribution.prototype.cdf = function (x) { 41 | return cephes.bdtr(x, this._size, this._properbility); 42 | }; 43 | 44 | BinomialDistribution.prototype.inv = function (p) { 45 | throw new Error('Inverse CDF of binomial distribution is not implemented'); 46 | }; 47 | 48 | BinomialDistribution.prototype.median = function () { 49 | return Math.round(this._properbility * this._size); 50 | }; 51 | 52 | BinomialDistribution.prototype.mean = function () { 53 | return this._properbility * this._size; 54 | }; 55 | 56 | BinomialDistribution.prototype.variance = function () { 57 | return this._properbility * this._size * (1 - this._properbility); 58 | }; 59 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/test/actual.test.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const test = require('tap').test; 5 | const cephes = require('../index.js'); 6 | const almostEqual = require("./almost-equal.js"); 7 | 8 | const expectedList = fs.readFileSync( 9 | path.resolve(__dirname, 'expected.ndjson') 10 | ) 11 | .toString() 12 | .split('\n') 13 | .slice(0, -1) 14 | .map((line) => JSON.parse(line)); 15 | 16 | const mtherr_codemsg = new Map([ 17 | [0, 'unknown error'], 18 | [1, 'argument domain error'], 19 | [2, 'function singularity'], 20 | [3, 'overflow range error'], 21 | [4, 'underflow range error'], 22 | [5, 'total loss of precision'], 23 | [6, 'partial loss of precision'], 24 | [33, 'Unix domain error code'], 25 | [34, 'Unix range error code'] 26 | ]); 27 | 28 | for (const { fn, ret, args, extra, error_code } of expectedList) { 29 | const hasExtra = Object.keys(extra).length > 0; 30 | const parsedArgs = args.map(function (arg) { 31 | if (Array.isArray(arg)) return new Float64Array(arg); 32 | else return arg; 33 | }); 34 | 35 | test(`random samples from ${fn}`, function (t) { 36 | if (error_code !== -1) { 37 | const codemsg = mtherr_codemsg.get(error_code); 38 | const message = new RegExp('^cephes reports "' + codemsg + '" in [a-z0-9]+$'); 39 | t.throws(() => cephes[fn].apply(null, parsedArgs), message); 40 | t.end(); 41 | return; 42 | } 43 | 44 | if (hasExtra) { 45 | let [actualRet, actualExtra] = cephes[fn].apply(null, parsedArgs); 46 | almostEqual(t, actualRet, ret); 47 | for (const extraKey of Object.keys(extra)) { 48 | almostEqual(t, actualExtra[extraKey], extra[extraKey]); 49 | } 50 | } else { 51 | let actualRet = cephes[fn].apply(null, parsedArgs); 52 | almostEqual(t, actualRet, ret); 53 | } 54 | 55 | t.end(); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/test/actual.test.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const test = require('tap').test; 5 | const cephes = require('../index.js'); 6 | const almostEqual = require("./almost-equal.js"); 7 | 8 | const expectedList = fs.readFileSync( 9 | path.resolve(__dirname, 'expected.ndjson') 10 | ) 11 | .toString() 12 | .split('\n') 13 | .slice(0, -1) 14 | .map((line) => JSON.parse(line)); 15 | 16 | const mtherr_codemsg = new Map([ 17 | [0, 'unknown error'], 18 | [1, 'argument domain error'], 19 | [2, 'function singularity'], 20 | [3, 'overflow range error'], 21 | [4, 'underflow range error'], 22 | [5, 'total loss of precision'], 23 | [6, 'partial loss of precision'], 24 | [33, 'Unix domain error code'], 25 | [34, 'Unix range error code'] 26 | ]); 27 | 28 | for (const { fn, ret, args, extra, error_code } of expectedList) { 29 | const hasExtra = Object.keys(extra).length > 0; 30 | const parsedArgs = args.map(function (arg) { 31 | if (Array.isArray(arg)) return new Float64Array(arg); 32 | else return arg; 33 | }); 34 | 35 | test(`random samples from ${fn}`, function (t) { 36 | if (error_code !== -1) { 37 | const codemsg = mtherr_codemsg.get(error_code); 38 | const message = new RegExp('^cephes reports "' + codemsg + '" in [a-z0-9]+$'); 39 | t.throws(() => cephes[fn].apply(null, parsedArgs), message); 40 | t.end(); 41 | return; 42 | } 43 | 44 | if (hasExtra) { 45 | let [actualRet, actualExtra] = cephes[fn].apply(null, parsedArgs); 46 | almostEqual(t, actualRet, ret); 47 | for (const extraKey of Object.keys(extra)) { 48 | almostEqual(t, actualExtra[extraKey], extra[extraKey]); 49 | } 50 | } else { 51 | let actualRet = cephes[fn].apply(null, parsedArgs); 52 | almostEqual(t, actualRet, ret); 53 | } 54 | 55 | t.end(); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/expx2.c: -------------------------------------------------------------------------------- 1 | /* expx2.c 2 | * 3 | * Exponential of squared argument 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, expx2(); 10 | * int sign; 11 | * 12 | * y = expx2( x, sign ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Computes y = exp(x*x) while suppressing error amplification 19 | * that would ordinarily arise from the inexactness of the 20 | * exponential argument x*x. 21 | * 22 | * If sign < 0, the result is inverted; i.e., y = exp(-x*x) . 23 | * 24 | * 25 | * ACCURACY: 26 | * 27 | * Relative error: 28 | * arithmetic domain # trials peak rms 29 | * IEEE -26.6, 26.6 10^7 3.9e-16 8.9e-17 30 | * 31 | */ 32 | 33 | /* 34 | Cephes Math Library Release 2.9: June, 2000 35 | Copyright 2000 by Stephen L. Moshier 36 | */ 37 | 38 | #include "mconf.h" 39 | 40 | #ifdef ANSIPROT 41 | extern double fabs(double); 42 | extern double floor(double); 43 | extern double exp(double); 44 | #else 45 | double fabs(); 46 | double floor(); 47 | double exp(); 48 | #endif 49 | 50 | #ifdef DEC 51 | #define M 32.0 52 | #define MINV .03125 53 | #else 54 | #define M 128.0 55 | #define MINV .0078125 56 | #endif 57 | 58 | extern double MAXLOG; 59 | extern double INFINITY; 60 | 61 | double expx2(x, sign) double x; 62 | int sign; 63 | { 64 | double u, u1, m, f; 65 | 66 | x = fabs(x); 67 | if (sign < 0) 68 | x = -x; 69 | 70 | /* Represent x as an exact multiple of M plus a residual. 71 | M is a power of 2 chosen so that exp(m * m) does not overflow 72 | or underflow and so that |x - m| is small. */ 73 | m = MINV * floor(M * x + 0.5); 74 | f = x - m; 75 | 76 | /* x^2 = m^2 + 2mf + f^2 */ 77 | u = m * m; 78 | u1 = 2 * m * f + f * f; 79 | 80 | if (sign < 0) { 81 | u = -u; 82 | u1 = -u1; 83 | } 84 | 85 | if ((u + u1) > MAXLOG) 86 | return (INFINITY); 87 | 88 | /* u is exact, u1 is small. */ 89 | u = exp(u) * exp(u1); 90 | return (u); 91 | } 92 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/chbevl.c: -------------------------------------------------------------------------------- 1 | #include "mconf.h" 2 | /* chbevl.c 3 | * 4 | * Evaluate Chebyshev series 5 | * 6 | * 7 | * 8 | * SYNOPSIS: 9 | * 10 | * int N; 11 | * double x, y, coef[N], chebevl(); 12 | * 13 | * y = chbevl( x, coef, N ); 14 | * 15 | * 16 | * 17 | * DESCRIPTION: 18 | * 19 | * Evaluates the series 20 | * 21 | * N-1 22 | * - ' 23 | * y = > coef[i] T (x/2) 24 | * - i 25 | * i=0 26 | * 27 | * of Chebyshev polynomials Ti at argument x/2. 28 | * 29 | * Coefficients are stored in reverse order, i.e. the zero 30 | * order term is last in the array. Note N is the number of 31 | * coefficients, not the order. 32 | * 33 | * If coefficients are for the interval a to b, x must 34 | * have been transformed to x -> 2(2x - b - a)/(b-a) before 35 | * entering the routine. This maps x from (a, b) to (-1, 1), 36 | * over which the Chebyshev polynomials are defined. 37 | * 38 | * If the coefficients are for the inverted interval, in 39 | * which (a, b) is mapped to (1/b, 1/a), the transformation 40 | * required is x -> 2(2ab/x - b - a)/(b-a). If b is infinity, 41 | * this becomes x -> 4a/x - 1. 42 | * 43 | * 44 | * 45 | * SPEED: 46 | * 47 | * Taking advantage of the recurrence properties of the 48 | * Chebyshev polynomials, the routine requires one more 49 | * addition per loop than evaluating a nested polynomial of 50 | * the same degree. 51 | * 52 | */ 53 | /* chbevl.c */ 54 | 55 | /* 56 | Cephes Math Library Release 2.0: April, 1987 57 | Copyright 1985, 1987 by Stephen L. Moshier 58 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 59 | */ 60 | 61 | double chbevl(x, array, n) double x; 62 | double array[]; 63 | int n; 64 | { 65 | double b0, b1, b2, *p; 66 | int i; 67 | 68 | p = array; 69 | b0 = *p++; 70 | b1 = 0.0; 71 | i = n - 1; 72 | 73 | do { 74 | b2 = b1; 75 | b1 = b0; 76 | b0 = x * b1 - b2 + *p++; 77 | } while (--i); 78 | 79 | return (0.5 * (b0 - b2)); 80 | } 81 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/expx2.c: -------------------------------------------------------------------------------- 1 | /* expx2.c 2 | * 3 | * Exponential of squared argument 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, expx2(); 10 | * int sign; 11 | * 12 | * y = expx2( x, sign ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Computes y = exp(x*x) while suppressing error amplification 19 | * that would ordinarily arise from the inexactness of the 20 | * exponential argument x*x. 21 | * 22 | * If sign < 0, the result is inverted; i.e., y = exp(-x*x) . 23 | * 24 | * 25 | * ACCURACY: 26 | * 27 | * Relative error: 28 | * arithmetic domain # trials peak rms 29 | * IEEE -26.6, 26.6 10^7 3.9e-16 8.9e-17 30 | * 31 | */ 32 | 33 | /* 34 | Cephes Math Library Release 2.9: June, 2000 35 | Copyright 2000 by Stephen L. Moshier 36 | */ 37 | 38 | #include "mconf.h" 39 | 40 | #ifdef ANSIPROT 41 | extern double fabs(double); 42 | extern double floor(double); 43 | extern double exp(double); 44 | #else 45 | double fabs(); 46 | double floor(); 47 | double exp(); 48 | #endif 49 | 50 | #ifdef DEC 51 | #define M 32.0 52 | #define MINV .03125 53 | #else 54 | #define M 128.0 55 | #define MINV .0078125 56 | #endif 57 | 58 | extern double MAXLOG; 59 | extern double INFINITY; 60 | 61 | double expx2(x, sign) double x; 62 | int sign; 63 | { 64 | double u, u1, m, f; 65 | 66 | x = fabs(x); 67 | if (sign < 0) 68 | x = -x; 69 | 70 | /* Represent x as an exact multiple of M plus a residual. 71 | M is a power of 2 chosen so that exp(m * m) does not overflow 72 | or underflow and so that |x - m| is small. */ 73 | m = MINV * floor(M * x + 0.5); 74 | f = x - m; 75 | 76 | /* x^2 = m^2 + 2mf + f^2 */ 77 | u = m * m; 78 | u1 = 2 * m * f + f * f; 79 | 80 | if (sign < 0) { 81 | u = -u; 82 | u1 = -u1; 83 | } 84 | 85 | if ((u + u1) > MAXLOG) 86 | return (INFINITY); 87 | 88 | /* u is exact, u1 is small. */ 89 | u = exp(u) * exp(u1); 90 | return (u); 91 | } 92 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/chbevl.c: -------------------------------------------------------------------------------- 1 | #include "mconf.h" 2 | /* chbevl.c 3 | * 4 | * Evaluate Chebyshev series 5 | * 6 | * 7 | * 8 | * SYNOPSIS: 9 | * 10 | * int N; 11 | * double x, y, coef[N], chebevl(); 12 | * 13 | * y = chbevl( x, coef, N ); 14 | * 15 | * 16 | * 17 | * DESCRIPTION: 18 | * 19 | * Evaluates the series 20 | * 21 | * N-1 22 | * - ' 23 | * y = > coef[i] T (x/2) 24 | * - i 25 | * i=0 26 | * 27 | * of Chebyshev polynomials Ti at argument x/2. 28 | * 29 | * Coefficients are stored in reverse order, i.e. the zero 30 | * order term is last in the array. Note N is the number of 31 | * coefficients, not the order. 32 | * 33 | * If coefficients are for the interval a to b, x must 34 | * have been transformed to x -> 2(2x - b - a)/(b-a) before 35 | * entering the routine. This maps x from (a, b) to (-1, 1), 36 | * over which the Chebyshev polynomials are defined. 37 | * 38 | * If the coefficients are for the inverted interval, in 39 | * which (a, b) is mapped to (1/b, 1/a), the transformation 40 | * required is x -> 2(2ab/x - b - a)/(b-a). If b is infinity, 41 | * this becomes x -> 4a/x - 1. 42 | * 43 | * 44 | * 45 | * SPEED: 46 | * 47 | * Taking advantage of the recurrence properties of the 48 | * Chebyshev polynomials, the routine requires one more 49 | * addition per loop than evaluating a nested polynomial of 50 | * the same degree. 51 | * 52 | */ 53 | /* chbevl.c */ 54 | 55 | /* 56 | Cephes Math Library Release 2.0: April, 1987 57 | Copyright 1985, 1987 by Stephen L. Moshier 58 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 59 | */ 60 | 61 | double chbevl(x, array, n) double x; 62 | double array[]; 63 | int n; 64 | { 65 | double b0, b1, b2, *p; 66 | int i; 67 | 68 | p = array; 69 | b0 = *p++; 70 | b1 = 0.0; 71 | i = n - 1; 72 | 73 | do { 74 | b2 = b1; 75 | b1 = b0; 76 | b0 = x * b1 - b2 + *p++; 77 | } while (--i); 78 | 79 | return (0.5 * (b0 - b2)); 80 | } 81 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/src/main.rs: -------------------------------------------------------------------------------- 1 | mod lib; 2 | 3 | fn main() { 4 | let mitata = clap::Command::new("mitata"); 5 | 6 | let matches = mitata 7 | .arg_required_else_help(true) 8 | .arg(clap::Arg::new("benchmark").required(true).forbid_empty_values(true).multiple_occurrences(true)).get_matches(); 9 | 10 | let benchmarks: Vec = matches.values_of("benchmark").unwrap().map(|x| x.to_string()).collect(); 11 | let mut options = lib::reporter::Options::new(&benchmarks.iter().map(|x| x.as_str()).collect::>()); 12 | 13 | options.percentiles = false; 14 | let mut results = Vec::with_capacity(benchmarks.len()); 15 | 16 | println!("{}", lib::fmt::color(&format!("cpu: {}", lib::cpu::name()), lib::fmt::Color::Gray)); 17 | println!("{}\n", lib::fmt::color(&format!("runtime: shell ({})", env!("TARGET")), lib::fmt::Color::Gray)); 18 | 19 | println!("{}", lib::reporter::header(&options)); 20 | 21 | println!("{}", lib::reporter::br(&options)); 22 | 23 | for cmd in benchmarks { 24 | let mut args = cmd.split(' '); 25 | let name = args.next().unwrap(); 26 | 27 | let stats = lib::bench::sync(std::time::Duration::from_millis(500), || { 28 | let mut cmd = std::process::Command::new(name); 29 | 30 | cmd 31 | .args(args.clone()) 32 | .stdin(std::process::Stdio::null()) 33 | .stdout(std::process::Stdio::null()) 34 | .stderr(std::process::Stdio::null()) 35 | 36 | .spawn().unwrap().wait().unwrap(); 37 | }, false); 38 | 39 | let stats = lib::reporter::BenchmarkStats { 40 | avg: stats.avg, 41 | min: stats.min, 42 | max: stats.max, 43 | p75: stats.p75, 44 | p99: stats.p99, 45 | p995: stats.p995, 46 | }; 47 | 48 | println!("{}", lib::reporter::benchmark(&cmd, &stats, &options)); 49 | 50 | results.push(lib::reporter::GroupBenchmark { 51 | name: cmd, 52 | stats: stats, 53 | baseline: false, 54 | group: "group".to_string(), 55 | }); 56 | } 57 | 58 | println!("\n{}", lib::reporter::summary(&results, &options)); 59 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/src/main.rs: -------------------------------------------------------------------------------- 1 | mod lib; 2 | 3 | fn main() { 4 | let mitata = clap::Command::new("mitata"); 5 | 6 | let matches = mitata 7 | .arg_required_else_help(true) 8 | .arg(clap::Arg::new("benchmark").required(true).forbid_empty_values(true).multiple_occurrences(true)).get_matches(); 9 | 10 | let benchmarks: Vec = matches.values_of("benchmark").unwrap().map(|x| x.to_string()).collect(); 11 | let mut options = lib::reporter::Options::new(&benchmarks.iter().map(|x| x.as_str()).collect::>()); 12 | 13 | options.percentiles = false; 14 | let mut results = Vec::with_capacity(benchmarks.len()); 15 | 16 | println!("{}", lib::fmt::color(&format!("cpu: {}", lib::cpu::name()), lib::fmt::Color::Gray)); 17 | println!("{}\n", lib::fmt::color(&format!("runtime: shell ({})", env!("TARGET")), lib::fmt::Color::Gray)); 18 | 19 | println!("{}", lib::reporter::header(&options)); 20 | 21 | println!("{}", lib::reporter::br(&options)); 22 | 23 | for cmd in benchmarks { 24 | let mut args = cmd.split(' '); 25 | let name = args.next().unwrap(); 26 | 27 | let stats = lib::bench::sync(std::time::Duration::from_millis(500), || { 28 | let mut cmd = std::process::Command::new(name); 29 | 30 | cmd 31 | .args(args.clone()) 32 | .stdin(std::process::Stdio::null()) 33 | .stdout(std::process::Stdio::null()) 34 | .stderr(std::process::Stdio::null()) 35 | 36 | .spawn().unwrap().wait().unwrap(); 37 | }, false); 38 | 39 | let stats = lib::reporter::BenchmarkStats { 40 | avg: stats.avg, 41 | min: stats.min, 42 | max: stats.max, 43 | p75: stats.p75, 44 | p99: stats.p99, 45 | p995: stats.p995, 46 | }; 47 | 48 | println!("{}", lib::reporter::benchmark(&cmd, &stats, &options)); 49 | 50 | results.push(lib::reporter::GroupBenchmark { 51 | name: cmd, 52 | stats: stats, 53 | baseline: false, 54 | group: "group".to_string(), 55 | }); 56 | } 57 | 58 | println!("\n{}", lib::reporter::summary(&results, &options)); 59 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/README.md: -------------------------------------------------------------------------------- 1 | ![Autocannon](https://raw.githubusercontent.com/mcollina/autocannon/master/autocannon-banner.png) 2 | 3 | # autocannon-compare 4 | 5 | Compare two autocannon runs, using 6 | [ttest](https://github.com/AndreasMadsen/ttest). 7 | 8 | ## Install 9 | 10 | Locally, for [API](#api) usage 11 | 12 | ``` 13 | npm i autocannon-compare --save 14 | ``` 15 | 16 | Globally, for [CLI](#cli) usage 17 | 18 | ``` 19 | npm i autocannon-compare -g 20 | ``` 21 | 22 | ## API 23 | 24 | ### compare(a, b) 25 | 26 | Compare the result of two autocannon run. 27 | It will tell how different is the `a` run compared 28 | to tbe `b` run. 29 | 30 | ```js 31 | { 32 | "requests": { 33 | "difference": "980.33%", 34 | "pValue": 0, 35 | "significant": "***" 36 | }, 37 | "throughput": { 38 | "difference": "976.68%", 39 | "pValue": 0, 40 | "significant": "***" 41 | }, 42 | "latency": { 43 | "difference": "-98.91%", 44 | "pValue": 0, 45 | "significant": "***" 46 | }, 47 | "aWins": true, 48 | "bWins": false, 49 | "equal": false 50 | } 51 | ``` 52 | 53 | ### Example 54 | 55 | ```js 56 | const compare = require('autocannon-compare') 57 | const resA = require('./result-a') 58 | const resB = require('./result-b') 59 | 60 | console.log(compare(resA, resB)) 61 | ``` 62 | 63 | ## CLI 64 | 65 | ``` 66 | $ autocannon-compare fixture-a.json fixture-b.json 67 | { 68 | "requests": { 69 | "difference": "980.33%", 70 | "pValue": 0, 71 | "significant": "***" 72 | }, 73 | "throughput": { 74 | "difference": "976.68%", 75 | "pValue": 0, 76 | "significant": "***" 77 | }, 78 | "latency": { 79 | "difference": "-98.91%", 80 | "pValue": 0, 81 | "significant": "***" 82 | }, 83 | "aWins": true, 84 | "bWins": false, 85 | "equal": false 86 | } 87 | ``` 88 | 89 | ## Acknowledgements 90 | 91 | This project was kindly sponsored by [nearForm](http://nearform.com). 92 | 93 | ## License 94 | 95 | Copyright [Matteo Collina](https://github.com/mcollina), Licensed under [MIT](./LICENSE). 96 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/polevl.c: -------------------------------------------------------------------------------- 1 | #include "mconf.h" 2 | /* polevl.c 3 | * p1evl.c 4 | * 5 | * Evaluate polynomial 6 | * 7 | * 8 | * 9 | * SYNOPSIS: 10 | * 11 | * int N; 12 | * double x, y, coef[N+1], polevl[]; 13 | * 14 | * y = polevl( x, coef, N ); 15 | * 16 | * 17 | * 18 | * DESCRIPTION: 19 | * 20 | * Evaluates polynomial of degree N: 21 | * 22 | * 2 N 23 | * y = C + C x + C x +...+ C x 24 | * 0 1 2 N 25 | * 26 | * Coefficients are stored in reverse order: 27 | * 28 | * coef[0] = C , ..., coef[N] = C . 29 | * N 0 30 | * 31 | * The function p1evl() assumes that coef[N] = 1.0 and is 32 | * omitted from the array. Its calling arguments are 33 | * otherwise the same as polevl(). 34 | * 35 | * 36 | * SPEED: 37 | * 38 | * In the interest of speed, there are no checks for out 39 | * of bounds arithmetic. This routine is used by most of 40 | * the functions in the library. Depending on available 41 | * equipment features, the user may wish to rewrite the 42 | * program in microcode or assembly language. 43 | * 44 | */ 45 | 46 | /* 47 | Cephes Math Library Release 2.1: December, 1988 48 | Copyright 1984, 1987, 1988 by Stephen L. Moshier 49 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 50 | */ 51 | 52 | double polevl(x, coef, N) double x; 53 | double coef[]; 54 | int N; 55 | { 56 | double ans; 57 | int i; 58 | double *p; 59 | 60 | p = coef; 61 | ans = *p++; 62 | i = N; 63 | 64 | do 65 | ans = ans * x + *p++; 66 | while (--i); 67 | 68 | return (ans); 69 | } 70 | 71 | /* p1evl() */ 72 | /* N 73 | * Evaluate polynomial when coefficient of x is 1.0. 74 | * Otherwise same as polevl. 75 | */ 76 | 77 | double p1evl(x, coef, N) double x; 78 | double coef[]; 79 | int N; 80 | { 81 | double ans; 82 | double *p; 83 | int i; 84 | 85 | p = coef; 86 | ans = x + *p++; 87 | i = N - 1; 88 | 89 | do 90 | ans = ans * x + *p++; 91 | while (--i); 92 | 93 | return (ans); 94 | } 95 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/polevl.c: -------------------------------------------------------------------------------- 1 | #include "mconf.h" 2 | /* polevl.c 3 | * p1evl.c 4 | * 5 | * Evaluate polynomial 6 | * 7 | * 8 | * 9 | * SYNOPSIS: 10 | * 11 | * int N; 12 | * double x, y, coef[N+1], polevl[]; 13 | * 14 | * y = polevl( x, coef, N ); 15 | * 16 | * 17 | * 18 | * DESCRIPTION: 19 | * 20 | * Evaluates polynomial of degree N: 21 | * 22 | * 2 N 23 | * y = C + C x + C x +...+ C x 24 | * 0 1 2 N 25 | * 26 | * Coefficients are stored in reverse order: 27 | * 28 | * coef[0] = C , ..., coef[N] = C . 29 | * N 0 30 | * 31 | * The function p1evl() assumes that coef[N] = 1.0 and is 32 | * omitted from the array. Its calling arguments are 33 | * otherwise the same as polevl(). 34 | * 35 | * 36 | * SPEED: 37 | * 38 | * In the interest of speed, there are no checks for out 39 | * of bounds arithmetic. This routine is used by most of 40 | * the functions in the library. Depending on available 41 | * equipment features, the user may wish to rewrite the 42 | * program in microcode or assembly language. 43 | * 44 | */ 45 | 46 | /* 47 | Cephes Math Library Release 2.1: December, 1988 48 | Copyright 1984, 1987, 1988 by Stephen L. Moshier 49 | Direct inquiries to 30 Frost Street, Cambridge, MA 02140 50 | */ 51 | 52 | double polevl(x, coef, N) double x; 53 | double coef[]; 54 | int N; 55 | { 56 | double ans; 57 | int i; 58 | double *p; 59 | 60 | p = coef; 61 | ans = *p++; 62 | i = N; 63 | 64 | do 65 | ans = ans * x + *p++; 66 | while (--i); 67 | 68 | return (ans); 69 | } 70 | 71 | /* p1evl() */ 72 | /* N 73 | * Evaluate polynomial when coefficient of x is 1.0. 74 | * Otherwise same as polevl. 75 | */ 76 | 77 | double p1evl(x, coef, N) double x; 78 | double coef[]; 79 | int N; 80 | { 81 | double ans; 82 | double *p; 83 | int i; 84 | 85 | p = coef; 86 | ans = x + *p++; 87 | i = N - 1; 88 | 89 | do 90 | ans = ans * x + *p++; 91 | while (--i); 92 | 93 | return (ans); 94 | } 95 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/build/reader-cproto-parser.js: -------------------------------------------------------------------------------- 1 | 2 | const stream = require('stream'); 3 | const split2 = require('split2'); 4 | const pumpify = require('pumpify'); 5 | 6 | const SPLIT_COMMENT = /^\/\* cephes\/([a-z0-9]+)\.c \*\/$/; 7 | const SPLIT_PROTO = /^(double|int) cephes_([a-z0-9]+)\(([A-Za-z0-9_ ,*\[\]]+)\);$/; 8 | const SPLIT_ARG = /^(double|int) (\*)?(?:cephes_)?([A-Za-z0-9]+)(\[\])?$/; 9 | 10 | class CprotoLineParser extends stream.Transform { 11 | constructor() { 12 | super({ objectMode: true }); 13 | 14 | this._currentFilename = ''; 15 | } 16 | 17 | _parseFilename(comment) { 18 | const [, filename ] = comment.match(SPLIT_COMMENT); 19 | this._currentFilename = filename; 20 | } 21 | 22 | _parseProto(proto) { 23 | const [ 24 | , returnType, functionName, functionArgsStr 25 | ] = proto.match(SPLIT_PROTO); 26 | 27 | const functionArgs = functionArgsStr.split(/, ?/).map(function (arg) { 28 | const [, mainType, pointer, name, array] = arg.match(SPLIT_ARG); 29 | return { 30 | type: mainType, 31 | isPointer: pointer === '*', 32 | name: name, 33 | isArray: array === '[]', 34 | isArrayLength: false, 35 | fullType: `${mainType}${pointer || ''}${array || ''}` 36 | }; 37 | }); 38 | 39 | let lastIsArray = false; 40 | for (const functionArg of functionArgs) { 41 | if (lastIsArray && functionArg.name.toLowerCase() === 'n') { 42 | functionArg.isArrayLength = true; 43 | } 44 | lastIsArray = functionArg.isArray; 45 | } 46 | 47 | this.push({ 48 | returnType, 49 | functionName, 50 | functionArgs, 51 | filename: this._currentFilename 52 | }); 53 | } 54 | 55 | _transform(line, encoding, done) { 56 | if (line.startsWith('/*')) { 57 | this._parseFilename(line); 58 | } else { 59 | this._parseProto(line); 60 | } 61 | 62 | done(null); 63 | } 64 | } 65 | 66 | function cprotoParser() { 67 | return pumpify.obj( 68 | split2(), 69 | new CprotoLineParser() 70 | ); 71 | } 72 | 73 | module.exports = cprotoParser; 74 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/build/reader-cproto-parser.js: -------------------------------------------------------------------------------- 1 | 2 | const stream = require('stream'); 3 | const split2 = require('split2'); 4 | const pumpify = require('pumpify'); 5 | 6 | const SPLIT_COMMENT = /^\/\* cephes\/([a-z0-9]+)\.c \*\/$/; 7 | const SPLIT_PROTO = /^(double|int) cephes_([a-z0-9]+)\(([A-Za-z0-9_ ,*\[\]]+)\);$/; 8 | const SPLIT_ARG = /^(double|int) (\*)?(?:cephes_)?([A-Za-z0-9]+)(\[\])?$/; 9 | 10 | class CprotoLineParser extends stream.Transform { 11 | constructor() { 12 | super({ objectMode: true }); 13 | 14 | this._currentFilename = ''; 15 | } 16 | 17 | _parseFilename(comment) { 18 | const [, filename ] = comment.match(SPLIT_COMMENT); 19 | this._currentFilename = filename; 20 | } 21 | 22 | _parseProto(proto) { 23 | const [ 24 | , returnType, functionName, functionArgsStr 25 | ] = proto.match(SPLIT_PROTO); 26 | 27 | const functionArgs = functionArgsStr.split(/, ?/).map(function (arg) { 28 | const [, mainType, pointer, name, array] = arg.match(SPLIT_ARG); 29 | return { 30 | type: mainType, 31 | isPointer: pointer === '*', 32 | name: name, 33 | isArray: array === '[]', 34 | isArrayLength: false, 35 | fullType: `${mainType}${pointer || ''}${array || ''}` 36 | }; 37 | }); 38 | 39 | let lastIsArray = false; 40 | for (const functionArg of functionArgs) { 41 | if (lastIsArray && functionArg.name.toLowerCase() === 'n') { 42 | functionArg.isArrayLength = true; 43 | } 44 | lastIsArray = functionArg.isArray; 45 | } 46 | 47 | this.push({ 48 | returnType, 49 | functionName, 50 | functionArgs, 51 | filename: this._currentFilename 52 | }); 53 | } 54 | 55 | _transform(line, encoding, done) { 56 | if (line.startsWith('/*')) { 57 | this._parseFilename(line); 58 | } else { 59 | this._parseProto(line); 60 | } 61 | 62 | done(null); 63 | } 64 | } 65 | 66 | function cprotoParser() { 67 | return pumpify.obj( 68 | split2(), 69 | new CprotoLineParser() 70 | ); 71 | } 72 | 73 | module.exports = cprotoParser; 74 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/test/basic.test.js: -------------------------------------------------------------------------------- 1 | 2 | const test = require('tap').test; 3 | const cephes = require('../index.js'); 4 | const almostEqual = require("./almost-equal.js"); 5 | 6 | test('plain function', function (t) { 7 | almostEqual(t, cephes.exp2(3.4), Math.pow(2, 3.4)); 8 | t.end(); 9 | }); 10 | 11 | test('extra function', function (t) { 12 | const [ret, {ai, aip, bi, bip}] = cephes.airy(1.2); 13 | almostEqual(t, ret, 0); 14 | 15 | // http://www.wolframalpha.com/input/?i=Ai(1.2),Ai%27(1.2),Bi(1.2),Bi%27(1.2) 16 | almostEqual(t, ai, 0.106126); 17 | almostEqual(t, aip, -0.132785); 18 | almostEqual(t, bi, 1.42113); 19 | almostEqual(t, bip, 1.22123); 20 | t.end(); 21 | }); 22 | 23 | test('array function', function (t) { 24 | almostEqual(t, 25 | cephes.polevl(1.1, new Float64Array([2.2, 3.3, 4.4].reverse()), 2), 26 | 2.2 + 3.3 * 1.1 + 4.4 * 1.1 * 1.1 27 | ); 28 | t.end(); 29 | }); 30 | 31 | test('throw error', function (t) { 32 | t.throws(() => cephes.zeta(0, 1), new RangeError('cephes reports "argument domain error" in zeta')); 33 | t.throws(() => cephes.zeta(1.2, -1), new Error('cephes reports "function singularity" in zeta')); 34 | t.end(); 35 | }); 36 | 37 | test('isfinite handling', function (t) { 38 | t.equal(cephes.isfinite(NaN), 0); 39 | t.equal(cephes.isfinite(Infinity), 0); 40 | t.equal(cephes.isfinite(-Infinity), 0); 41 | t.equal(cephes.isfinite(-1), 1); 42 | t.equal(cephes.isfinite(1), 1); 43 | t.equal(cephes.isfinite(0), 1); 44 | t.end(); 45 | }); 46 | 47 | test('isnan handling', function (t) { 48 | t.equal(cephes.isnan(NaN), 1); 49 | t.equal(cephes.isnan(Infinity), 0); 50 | t.equal(cephes.isnan(-Infinity), 0); 51 | t.equal(cephes.isnan(-1), 0); 52 | t.equal(cephes.isnan(1), 0); 53 | t.equal(cephes.isnan(0), 0); 54 | t.end(); 55 | }); 56 | 57 | test('nan returned', function (t) { 58 | t.ok(Number.isNaN(cephes.gamma(-Infinity))); 59 | t.end(); 60 | }) 61 | 62 | test('infinity returned', function (t) { 63 | const MAXL10 = 308.2547155599167; 64 | t.equal(cephes.exp10(MAXL10 + 1), Infinity); 65 | t.end(); 66 | }) 67 | 68 | 69 | test("compiled is a promise", async function (t) { 70 | await cephes.compiled; 71 | almostEqual(t, cephes.exp(2), Math.exp(2)); 72 | t.end(); 73 | }); 74 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/test/basic.test.js: -------------------------------------------------------------------------------- 1 | 2 | const test = require('tap').test; 3 | const cephes = require('../index.js'); 4 | const almostEqual = require("./almost-equal.js"); 5 | 6 | test('plain function', function (t) { 7 | almostEqual(t, cephes.exp2(3.4), Math.pow(2, 3.4)); 8 | t.end(); 9 | }); 10 | 11 | test('extra function', function (t) { 12 | const [ret, {ai, aip, bi, bip}] = cephes.airy(1.2); 13 | almostEqual(t, ret, 0); 14 | 15 | // http://www.wolframalpha.com/input/?i=Ai(1.2),Ai%27(1.2),Bi(1.2),Bi%27(1.2) 16 | almostEqual(t, ai, 0.106126); 17 | almostEqual(t, aip, -0.132785); 18 | almostEqual(t, bi, 1.42113); 19 | almostEqual(t, bip, 1.22123); 20 | t.end(); 21 | }); 22 | 23 | test('array function', function (t) { 24 | almostEqual(t, 25 | cephes.polevl(1.1, new Float64Array([2.2, 3.3, 4.4].reverse()), 2), 26 | 2.2 + 3.3 * 1.1 + 4.4 * 1.1 * 1.1 27 | ); 28 | t.end(); 29 | }); 30 | 31 | test('throw error', function (t) { 32 | t.throws(() => cephes.zeta(0, 1), new RangeError('cephes reports "argument domain error" in zeta')); 33 | t.throws(() => cephes.zeta(1.2, -1), new Error('cephes reports "function singularity" in zeta')); 34 | t.end(); 35 | }); 36 | 37 | test('isfinite handling', function (t) { 38 | t.equal(cephes.isfinite(NaN), 0); 39 | t.equal(cephes.isfinite(Infinity), 0); 40 | t.equal(cephes.isfinite(-Infinity), 0); 41 | t.equal(cephes.isfinite(-1), 1); 42 | t.equal(cephes.isfinite(1), 1); 43 | t.equal(cephes.isfinite(0), 1); 44 | t.end(); 45 | }); 46 | 47 | test('isnan handling', function (t) { 48 | t.equal(cephes.isnan(NaN), 1); 49 | t.equal(cephes.isnan(Infinity), 0); 50 | t.equal(cephes.isnan(-Infinity), 0); 51 | t.equal(cephes.isnan(-1), 0); 52 | t.equal(cephes.isnan(1), 0); 53 | t.equal(cephes.isnan(0), 0); 54 | t.end(); 55 | }); 56 | 57 | test('nan returned', function (t) { 58 | t.ok(Number.isNaN(cephes.gamma(-Infinity))); 59 | t.end(); 60 | }) 61 | 62 | test('infinity returned', function (t) { 63 | const MAXL10 = 308.2547155599167; 64 | t.equal(cephes.exp10(MAXL10 + 1), Infinity); 65 | t.end(); 66 | }) 67 | 68 | 69 | test("compiled is a promise", async function (t) { 70 | await cephes.compiled; 71 | almostEqual(t, cephes.exp(2), Math.exp(2)); 72 | t.end(); 73 | }); 74 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/distributions/distributions/studentt.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function StudenttDistribution(df) { 5 | if (!(this instanceof StudenttDistribution)) { 6 | return new StudenttDistribution(df); 7 | } 8 | 9 | if (typeof df !== 'number') { 10 | throw TypeError('mean must be a number'); 11 | } 12 | if (df <= 0) { 13 | throw RangeError('df must be a positive number'); 14 | } 15 | 16 | this._df = df; 17 | 18 | this._pdf_const = Math.exp(cephes.lgam((df + 1) / 2) - cephes.lgam(df / 2)) / Math.sqrt(this._df * Math.PI); 19 | } 20 | module.exports = StudenttDistribution; 21 | 22 | StudenttDistribution.prototype.pdf = function (x) { 23 | return this._pdf_const / Math.pow(1 + ((x*x) / this._df), (this._df + 1) / 2); 24 | }; 25 | 26 | // Uses the idendenity specified in Abramowitz and Stegun 26.7.1 and 27 | // Abramowitz and Stegun 26.5.27. 28 | // F(x|df) = 1 - 0.5 * I_z (df/2, 1/2) 29 | // z = df / (df + x^2) 30 | // for x > 0 31 | // Since the Student-t distribution is symetric: 32 | // F(x|df) = 0.5 * I_z (df/2, 1/2) 33 | // for x < 0 34 | StudenttDistribution.prototype.cdf = function (x) { 35 | const z = this._df / (this._df + x * x); 36 | const p = 0.5 * cephes.incbet(0.5 * this._df, 0.5, z); 37 | return (x <= 0) ? p : 1 - p; 38 | }; 39 | 40 | StudenttDistribution.prototype.inv = function (p) { 41 | if (p <= 0) return -Infinity; 42 | if (p >= 1) return Infinity; 43 | if (p === 0.5) return 0; 44 | 45 | if (p > 0.25 && p < 0.75) { 46 | const phat = 1 - 2 * p; 47 | const z = cephes.incbi(0.5, 0.5 * this._df, Math.abs(phat)); 48 | const t = Math.sqrt(this._df * z / (1 - z)); 49 | return (p < 0.5) ? -t : t; 50 | } else { 51 | const phat = (p >= 0.5) ? 1 - p : p; 52 | const z = cephes.incbi(0.5 * this._df, 0.5, 2 * phat); 53 | const t = Math.sqrt(this._df / z - this._df); 54 | return (p < 0.5) ? -t : t; 55 | } 56 | }; 57 | 58 | StudenttDistribution.prototype.median = function () { 59 | return 0; 60 | }; 61 | 62 | StudenttDistribution.prototype.mean = function () { 63 | return (this._df > 1) ? 0 : undefined; 64 | }; 65 | 66 | StudenttDistribution.prototype.variance = function () { 67 | if (this._df > 2) return this._df / (this._df - 2); 68 | else if (this._df > 1) return Infinity; 69 | else return undefined; 70 | }; 71 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/distributions/distributions/studentt.js: -------------------------------------------------------------------------------- 1 | 2 | var cephes = require('cephes'); 3 | 4 | function StudenttDistribution(df) { 5 | if (!(this instanceof StudenttDistribution)) { 6 | return new StudenttDistribution(df); 7 | } 8 | 9 | if (typeof df !== 'number') { 10 | throw TypeError('mean must be a number'); 11 | } 12 | if (df <= 0) { 13 | throw RangeError('df must be a positive number'); 14 | } 15 | 16 | this._df = df; 17 | 18 | this._pdf_const = Math.exp(cephes.lgam((df + 1) / 2) - cephes.lgam(df / 2)) / Math.sqrt(this._df * Math.PI); 19 | } 20 | module.exports = StudenttDistribution; 21 | 22 | StudenttDistribution.prototype.pdf = function (x) { 23 | return this._pdf_const / Math.pow(1 + ((x*x) / this._df), (this._df + 1) / 2); 24 | }; 25 | 26 | // Uses the idendenity specified in Abramowitz and Stegun 26.7.1 and 27 | // Abramowitz and Stegun 26.5.27. 28 | // F(x|df) = 1 - 0.5 * I_z (df/2, 1/2) 29 | // z = df / (df + x^2) 30 | // for x > 0 31 | // Since the Student-t distribution is symetric: 32 | // F(x|df) = 0.5 * I_z (df/2, 1/2) 33 | // for x < 0 34 | StudenttDistribution.prototype.cdf = function (x) { 35 | const z = this._df / (this._df + x * x); 36 | const p = 0.5 * cephes.incbet(0.5 * this._df, 0.5, z); 37 | return (x <= 0) ? p : 1 - p; 38 | }; 39 | 40 | StudenttDistribution.prototype.inv = function (p) { 41 | if (p <= 0) return -Infinity; 42 | if (p >= 1) return Infinity; 43 | if (p === 0.5) return 0; 44 | 45 | if (p > 0.25 && p < 0.75) { 46 | const phat = 1 - 2 * p; 47 | const z = cephes.incbi(0.5, 0.5 * this._df, Math.abs(phat)); 48 | const t = Math.sqrt(this._df * z / (1 - z)); 49 | return (p < 0.5) ? -t : t; 50 | } else { 51 | const phat = (p >= 0.5) ? 1 - p : p; 52 | const z = cephes.incbi(0.5 * this._df, 0.5, 2 * phat); 53 | const t = Math.sqrt(this._df / z - this._df); 54 | return (p < 0.5) ? -t : t; 55 | } 56 | }; 57 | 58 | StudenttDistribution.prototype.median = function () { 59 | return 0; 60 | }; 61 | 62 | StudenttDistribution.prototype.mean = function () { 63 | return (this._df > 1) ? 0 : undefined; 64 | }; 65 | 66 | StudenttDistribution.prototype.variance = function () { 67 | if (this._df > 2) return this._df / (this._df - 2); 68 | else if (this._df > 1) return Infinity; 69 | else return undefined; 70 | }; 71 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/yn.c: -------------------------------------------------------------------------------- 1 | /* yn.c 2 | * 3 | * Bessel function of second kind of integer order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, yn(); 10 | * int n; 11 | * 12 | * y = yn( n, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns Bessel function of order n, where n is a 19 | * (possibly negative) integer. 20 | * 21 | * The function is evaluated by forward recurrence on 22 | * n, starting with values computed by the routines 23 | * y0() and y1(). 24 | * 25 | * If n = 0 or 1 the routine for y0 or y1 is called 26 | * directly. 27 | * 28 | * 29 | * 30 | * ACCURACY: 31 | * 32 | * 33 | * Absolute error, except relative 34 | * when y > 1: 35 | * arithmetic domain # trials peak rms 36 | * DEC 0, 30 2200 2.9e-16 5.3e-17 37 | * IEEE 0, 30 30000 3.4e-15 4.3e-16 38 | * 39 | * 40 | * ERROR MESSAGES: 41 | * 42 | * message condition value returned 43 | * yn singularity x = 0 MAXNUM 44 | * yn overflow MAXNUM 45 | * 46 | * Spot checked against tables for x, n between 0 and 100. 47 | * 48 | */ 49 | 50 | /* 51 | Cephes Math Library Release 2.8: June, 2000 52 | Copyright 1984, 1987, 2000 by Stephen L. Moshier 53 | */ 54 | 55 | #include "mconf.h" 56 | #ifdef ANSIPROT 57 | extern double y0(double); 58 | extern double y1(double); 59 | extern double log(double); 60 | #else 61 | double y0(), y1(), log(); 62 | #endif 63 | extern double MAXNUM, MAXLOG; 64 | 65 | double yn(n, x) int n; 66 | double x; 67 | { 68 | double an, anm1, anm2, r; 69 | int k, sign; 70 | 71 | if (n < 0) { 72 | n = -n; 73 | if ((n & 1) == 0) /* -1**n */ 74 | sign = 1; 75 | else 76 | sign = -1; 77 | } else 78 | sign = 1; 79 | 80 | if (n == 0) 81 | return (sign * y0(x)); 82 | if (n == 1) 83 | return (sign * y1(x)); 84 | 85 | /* test for overflow */ 86 | if (x <= 0.0) { 87 | mtherr("yn", SING); 88 | return (-MAXNUM); 89 | } 90 | 91 | /* forward recurrence on n */ 92 | 93 | anm2 = y0(x); 94 | anm1 = y1(x); 95 | k = 1; 96 | r = 2 * k; 97 | do { 98 | an = r * anm1 / x - anm2; 99 | anm2 = anm1; 100 | anm1 = an; 101 | r += 2.0; 102 | ++k; 103 | } while (k < n); 104 | 105 | return (sign * an); 106 | } 107 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/yn.c: -------------------------------------------------------------------------------- 1 | /* yn.c 2 | * 3 | * Bessel function of second kind of integer order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double x, y, yn(); 10 | * int n; 11 | * 12 | * y = yn( n, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns Bessel function of order n, where n is a 19 | * (possibly negative) integer. 20 | * 21 | * The function is evaluated by forward recurrence on 22 | * n, starting with values computed by the routines 23 | * y0() and y1(). 24 | * 25 | * If n = 0 or 1 the routine for y0 or y1 is called 26 | * directly. 27 | * 28 | * 29 | * 30 | * ACCURACY: 31 | * 32 | * 33 | * Absolute error, except relative 34 | * when y > 1: 35 | * arithmetic domain # trials peak rms 36 | * DEC 0, 30 2200 2.9e-16 5.3e-17 37 | * IEEE 0, 30 30000 3.4e-15 4.3e-16 38 | * 39 | * 40 | * ERROR MESSAGES: 41 | * 42 | * message condition value returned 43 | * yn singularity x = 0 MAXNUM 44 | * yn overflow MAXNUM 45 | * 46 | * Spot checked against tables for x, n between 0 and 100. 47 | * 48 | */ 49 | 50 | /* 51 | Cephes Math Library Release 2.8: June, 2000 52 | Copyright 1984, 1987, 2000 by Stephen L. Moshier 53 | */ 54 | 55 | #include "mconf.h" 56 | #ifdef ANSIPROT 57 | extern double y0(double); 58 | extern double y1(double); 59 | extern double log(double); 60 | #else 61 | double y0(), y1(), log(); 62 | #endif 63 | extern double MAXNUM, MAXLOG; 64 | 65 | double yn(n, x) int n; 66 | double x; 67 | { 68 | double an, anm1, anm2, r; 69 | int k, sign; 70 | 71 | if (n < 0) { 72 | n = -n; 73 | if ((n & 1) == 0) /* -1**n */ 74 | sign = 1; 75 | else 76 | sign = -1; 77 | } else 78 | sign = 1; 79 | 80 | if (n == 0) 81 | return (sign * y0(x)); 82 | if (n == 1) 83 | return (sign * y1(x)); 84 | 85 | /* test for overflow */ 86 | if (x <= 0.0) { 87 | mtherr("yn", SING); 88 | return (-MAXNUM); 89 | } 90 | 91 | /* forward recurrence on n */ 92 | 93 | anm2 = y0(x); 94 | anm1 = y1(x); 95 | k = 1; 96 | r = 2 * k; 97 | do { 98 | an = r * anm1 / x - anm2; 99 | anm2 = anm1; 100 | anm1 = an; 101 | r += 2.0; 102 | ++k; 103 | } while (k < n); 104 | 105 | return (sign * an); 106 | } 107 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/compare.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 'use strict' 3 | 4 | const fs = require('fs') 5 | const ttest = require('ttest') 6 | 7 | function compare (a, b) { 8 | const aRequests = a.requests.total 9 | const bRequests = b.requests.total 10 | 11 | const res = { 12 | requests: calculate(a.requests, b.requests, aRequests, bRequests), 13 | throughput: calculate(a.throughput, b.throughput, a.duration, b.duration), 14 | latency: calculate(a.latency, b.latency, aRequests, bRequests) 15 | } 16 | 17 | const diff = parseFloat(res.throughput.difference) 18 | 19 | const aWins = !res.throughput.valid && diff > 5 20 | 21 | const bWins = !res.throughput.valid && diff < -5 22 | 23 | res.aWins = aWins 24 | res.bWins = bWins 25 | res.equal = !aWins && !bWins 26 | 27 | return res 28 | } 29 | 30 | function calculate (a, b, samplesA, samplesB) { 31 | const stat = ttest(asData(a, samplesA), asData(b, samplesB), { 32 | varEqual: false, 33 | alpha: 0.10 34 | }) 35 | 36 | const difference = (Math.round((a.mean - b.mean) / b.mean * 100 * 100, 2) / 100) + '%' 37 | 38 | return { 39 | valid: stat.valid(), 40 | difference, 41 | pValue: stat.pValue(), 42 | significant: asSignificant(stat.pValue()) 43 | } 44 | } 45 | 46 | function asData (obj, samples) { 47 | const res = { 48 | mean: obj.mean, 49 | variance: Math.pow(obj.stddev, 2), 50 | size: samples 51 | } 52 | return res 53 | } 54 | 55 | function asSignificant (value) { 56 | var significant = '' 57 | 58 | if (value < 0.001) { 59 | significant = '***' 60 | } else if (value < 0.01) { 61 | significant = '**' 62 | } else if (value < 0.05) { 63 | significant = '*' 64 | } 65 | 66 | return significant 67 | } 68 | 69 | module.exports = compare 70 | 71 | if (require.main === module) { 72 | cli() 73 | } 74 | 75 | function cli () { 76 | const args = process.argv.slice(2) 77 | 78 | if (args.length !== 2) { 79 | console.log('Usage: autocannon-compare A B') 80 | process.exit(1) 81 | } 82 | 83 | fs.readFile(args[0], function (err, data) { 84 | if (err) { 85 | throw err 86 | } 87 | 88 | const A = JSON.parse(data) 89 | 90 | fs.readFile(args[1], function (err, data) { 91 | if (err) { 92 | throw err 93 | } 94 | 95 | const B = JSON.parse(data) 96 | 97 | console.log(JSON.stringify(compare(A, B), null, 2)) 98 | }) 99 | }) 100 | } 101 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/ttest/test/simple/two-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const test = require('tap').test; 4 | const ttest = require('../../hypothesis.js'); 5 | const equals = require('../equals.js'); 6 | 7 | const summary = require('summary'); 8 | 9 | test('testing not equal alternative', function (t) { 10 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 11 | mu: 1, 12 | varEqual: true, 13 | alpha: 0.05, 14 | alternative: 'not equal' 15 | }); 16 | 17 | equals(t, res, { 18 | valid: true, 19 | freedom: 8, 20 | 21 | pValue: 0.225571973816597132200811870462, 22 | testValue: -1.313064328597225660644198796945, 23 | 24 | confidence: [ 25 | -1.756200427489884585696700014523, 26 | 1.756200427489884585696700014523 27 | ] 28 | }); 29 | 30 | t.end(); 31 | }); 32 | 33 | test('testing not equal alternative', function (t) { 34 | const res = ttest(summary([1, 2, 2, 2, 4]), summary([0, 3, 3, 3, 2]), { 35 | mu: 1, 36 | varEqual: true, 37 | alpha: 0.05, 38 | alternative: 'not equal' 39 | }); 40 | 41 | equals(t, res, { 42 | valid: true, 43 | freedom: 8, 44 | 45 | pValue: 0.225571973816597132200811870462, 46 | testValue: -1.313064328597225660644198796945, 47 | 48 | confidence: [ 49 | -1.756200427489884585696700014523, 50 | 1.756200427489884585696700014523 51 | ] 52 | }); 53 | 54 | t.end(); 55 | }); 56 | 57 | test('testing less alternative', function (t) { 58 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 59 | mu: 1, 60 | varEqual: true, 61 | alpha: 0.05, 62 | alternative: 'less' 63 | }); 64 | 65 | equals(t, res, { 66 | valid: true, 67 | freedom: 8, 68 | 69 | pValue: 0.112785986908298566100405935231, 70 | testValue: -1.313064328597225660644198796945, 71 | 72 | confidence: [ 73 | -Infinity, 74 | 1.416189593328981199960026060580 75 | ] 76 | }); 77 | 78 | t.end(); 79 | }); 80 | 81 | test('testing greater alternative', function (t) { 82 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 83 | mu: 1, 84 | varEqual: true, 85 | alpha: 0.05, 86 | alternative: 'greater' 87 | }); 88 | 89 | equals(t, res, { 90 | valid: true, 91 | freedom: 8, 92 | 93 | pValue: 0.887214013091701447777381872584, 94 | testValue: -1.313064328597225660644198796945, 95 | 96 | confidence: [ 97 | -1.416189593328981199960026060580, 98 | Infinity 99 | ] 100 | }); 101 | 102 | t.end(); 103 | }); 104 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/ttest/test/simple/two-data-set.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const test = require('tap').test; 4 | const ttest = require('../../hypothesis.js'); 5 | const equals = require('../equals.js'); 6 | 7 | const summary = require('summary'); 8 | 9 | test('testing not equal alternative', function (t) { 10 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 11 | mu: 1, 12 | varEqual: true, 13 | alpha: 0.05, 14 | alternative: 'not equal' 15 | }); 16 | 17 | equals(t, res, { 18 | valid: true, 19 | freedom: 8, 20 | 21 | pValue: 0.225571973816597132200811870462, 22 | testValue: -1.313064328597225660644198796945, 23 | 24 | confidence: [ 25 | -1.756200427489884585696700014523, 26 | 1.756200427489884585696700014523 27 | ] 28 | }); 29 | 30 | t.end(); 31 | }); 32 | 33 | test('testing not equal alternative', function (t) { 34 | const res = ttest(summary([1, 2, 2, 2, 4]), summary([0, 3, 3, 3, 2]), { 35 | mu: 1, 36 | varEqual: true, 37 | alpha: 0.05, 38 | alternative: 'not equal' 39 | }); 40 | 41 | equals(t, res, { 42 | valid: true, 43 | freedom: 8, 44 | 45 | pValue: 0.225571973816597132200811870462, 46 | testValue: -1.313064328597225660644198796945, 47 | 48 | confidence: [ 49 | -1.756200427489884585696700014523, 50 | 1.756200427489884585696700014523 51 | ] 52 | }); 53 | 54 | t.end(); 55 | }); 56 | 57 | test('testing less alternative', function (t) { 58 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 59 | mu: 1, 60 | varEqual: true, 61 | alpha: 0.05, 62 | alternative: 'less' 63 | }); 64 | 65 | equals(t, res, { 66 | valid: true, 67 | freedom: 8, 68 | 69 | pValue: 0.112785986908298566100405935231, 70 | testValue: -1.313064328597225660644198796945, 71 | 72 | confidence: [ 73 | -Infinity, 74 | 1.416189593328981199960026060580 75 | ] 76 | }); 77 | 78 | t.end(); 79 | }); 80 | 81 | test('testing greater alternative', function (t) { 82 | const res = ttest([1, 2, 2, 2, 4], [0, 3, 3, 3, 2], { 83 | mu: 1, 84 | varEqual: true, 85 | alpha: 0.05, 86 | alternative: 'greater' 87 | }); 88 | 89 | equals(t, res, { 90 | valid: true, 91 | freedom: 8, 92 | 93 | pValue: 0.887214013091701447777381872584, 94 | testValue: -1.313064328597225660644198796945, 95 | 96 | confidence: [ 97 | -1.416189593328981199960026060580, 98 | Infinity 99 | ] 100 | }); 101 | 102 | t.end(); 103 | }); 104 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/build/reader.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const stream = require('stream'); 5 | const split2 = require('split2'); 6 | const pumpify = require('pumpify'); 7 | 8 | const cprotoParser = require('./reader-cproto-parser.js'); 9 | const docParser = require('./reader-doc-parser.js'); 10 | 11 | const DOC_FILE = path.resolve(__dirname, '..', 'cephes', 'cephes.txt'); 12 | 13 | const INTERNAL_CEPHES_FUNCTIONS = new Set([ 14 | 'hyp2f0', 'onef2', 'threef0' 15 | ]); 16 | 17 | class MergeDocumentation extends stream.Transform { 18 | constructor() { 19 | super({ objectMode: true }); 20 | 21 | this._prototypes = new Map(); 22 | 23 | this._documentationEnded = false; 24 | this._documentation = []; 25 | 26 | this._documentationStream = fs.createReadStream(DOC_FILE) 27 | .pipe(docParser()) 28 | .on('data', (doc) => this._documentation.push(doc)) 29 | .once('end', (err) => this._documentationEnded = true) 30 | .on('error', (err) => this.emit('error', err)); 31 | } 32 | 33 | _transform(proto, encoding, done) { 34 | this._prototypes.set(proto.functionName, proto); 35 | done(null); 36 | } 37 | 38 | _finish(done) { 39 | // Validate that no documentation is missing 40 | const documentationParts = new Set( 41 | this._documentation.map((doc) => doc.functionName) 42 | ); 43 | for (const protoFunctionName of this._prototypes.keys()) { 44 | if (INTERNAL_CEPHES_FUNCTIONS.has(protoFunctionName)) continue; 45 | 46 | if (!documentationParts.has(protoFunctionName)) { 47 | throw new Error(`documentation for ${protoFunctionName} is missing`); 48 | } 49 | } 50 | 51 | // Merge data 52 | // The order of the documentation stream is meaninful, so use the 53 | // documentation as the order and merge in the prototypes. 54 | for (const doc of this._documentation) { 55 | if (INTERNAL_CEPHES_FUNCTIONS.has(doc.functionName)) continue; 56 | 57 | if (this._prototypes.has(doc.functionName)) { 58 | this.push( 59 | Object.assign({}, doc, this._prototypes.get(doc.functionName)) 60 | ); 61 | } 62 | } 63 | 64 | done(null); 65 | } 66 | 67 | _flush(done) { 68 | if (this._documentationEnded) { 69 | process.nextTick(() => this._finish(done)); 70 | } else { 71 | this._documentationStream.once('end', () => this._finish(done)); 72 | } 73 | } 74 | } 75 | 76 | 77 | function parser() { 78 | return pumpify.obj( 79 | cprotoParser(), 80 | new MergeDocumentation() 81 | ); 82 | } 83 | 84 | module.exports = parser; 85 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/gdtr.c: -------------------------------------------------------------------------------- 1 | /* gdtr.c 2 | * 3 | * Gamma distribution function 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double a, b, x, y, gdtr(); 10 | * 11 | * y = gdtr( a, b, x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns the integral from zero to x of the gamma probability 18 | * density function: 19 | * 20 | * 21 | * x 22 | * b - 23 | * a | | b-1 -at 24 | * y = ----- | t e dt 25 | * - | | 26 | * | (b) - 27 | * 0 28 | * 29 | * The incomplete gamma integral is used, according to the 30 | * relation 31 | * 32 | * y = igam( b, ax ). 33 | * 34 | * 35 | * ACCURACY: 36 | * 37 | * See igam(). 38 | * 39 | * ERROR MESSAGES: 40 | * 41 | * message condition value returned 42 | * gdtr domain x < 0 0.0 43 | * 44 | */ 45 | /* gdtrc.c 46 | * 47 | * Complemented gamma distribution function 48 | * 49 | * 50 | * 51 | * SYNOPSIS: 52 | * 53 | * double a, b, x, y, gdtrc(); 54 | * 55 | * y = gdtrc( a, b, x ); 56 | * 57 | * 58 | * 59 | * DESCRIPTION: 60 | * 61 | * Returns the integral from x to infinity of the gamma 62 | * probability density function: 63 | * 64 | * 65 | * inf. 66 | * b - 67 | * a | | b-1 -at 68 | * y = ----- | t e dt 69 | * - | | 70 | * | (b) - 71 | * x 72 | * 73 | * The incomplete gamma integral is used, according to the 74 | * relation 75 | * 76 | * y = igamc( b, ax ). 77 | * 78 | * 79 | * ACCURACY: 80 | * 81 | * See igamc(). 82 | * 83 | * ERROR MESSAGES: 84 | * 85 | * message condition value returned 86 | * gdtrc domain x < 0 0.0 87 | * 88 | */ 89 | 90 | /* gdtr() */ 91 | 92 | /* 93 | Cephes Math Library Release 2.8: June, 2000 94 | Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier 95 | */ 96 | 97 | #include "mconf.h" 98 | #ifdef ANSIPROT 99 | extern double igam(double, double); 100 | extern double igamc(double, double); 101 | #else 102 | double igam(), igamc(); 103 | #endif 104 | 105 | double gdtr(a, b, x) double a, b, x; 106 | { 107 | 108 | if (x < 0.0) { 109 | mtherr("gdtr", DOMAIN); 110 | return (0.0); 111 | } 112 | return (igam(b, a * x)); 113 | } 114 | 115 | double gdtrc(a, b, x) double a, b, x; 116 | { 117 | 118 | if (x < 0.0) { 119 | mtherr("gdtrc", DOMAIN); 120 | return (0.0); 121 | } 122 | return (igamc(b, a * x)); 123 | } 124 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/build/reader.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const stream = require('stream'); 5 | const split2 = require('split2'); 6 | const pumpify = require('pumpify'); 7 | 8 | const cprotoParser = require('./reader-cproto-parser.js'); 9 | const docParser = require('./reader-doc-parser.js'); 10 | 11 | const DOC_FILE = path.resolve(__dirname, '..', 'cephes', 'cephes.txt'); 12 | 13 | const INTERNAL_CEPHES_FUNCTIONS = new Set([ 14 | 'hyp2f0', 'onef2', 'threef0' 15 | ]); 16 | 17 | class MergeDocumentation extends stream.Transform { 18 | constructor() { 19 | super({ objectMode: true }); 20 | 21 | this._prototypes = new Map(); 22 | 23 | this._documentationEnded = false; 24 | this._documentation = []; 25 | 26 | this._documentationStream = fs.createReadStream(DOC_FILE) 27 | .pipe(docParser()) 28 | .on('data', (doc) => this._documentation.push(doc)) 29 | .once('end', (err) => this._documentationEnded = true) 30 | .on('error', (err) => this.emit('error', err)); 31 | } 32 | 33 | _transform(proto, encoding, done) { 34 | this._prototypes.set(proto.functionName, proto); 35 | done(null); 36 | } 37 | 38 | _finish(done) { 39 | // Validate that no documentation is missing 40 | const documentationParts = new Set( 41 | this._documentation.map((doc) => doc.functionName) 42 | ); 43 | for (const protoFunctionName of this._prototypes.keys()) { 44 | if (INTERNAL_CEPHES_FUNCTIONS.has(protoFunctionName)) continue; 45 | 46 | if (!documentationParts.has(protoFunctionName)) { 47 | throw new Error(`documentation for ${protoFunctionName} is missing`); 48 | } 49 | } 50 | 51 | // Merge data 52 | // The order of the documentation stream is meaninful, so use the 53 | // documentation as the order and merge in the prototypes. 54 | for (const doc of this._documentation) { 55 | if (INTERNAL_CEPHES_FUNCTIONS.has(doc.functionName)) continue; 56 | 57 | if (this._prototypes.has(doc.functionName)) { 58 | this.push( 59 | Object.assign({}, doc, this._prototypes.get(doc.functionName)) 60 | ); 61 | } 62 | } 63 | 64 | done(null); 65 | } 66 | 67 | _flush(done) { 68 | if (this._documentationEnded) { 69 | process.nextTick(() => this._finish(done)); 70 | } else { 71 | this._documentationStream.once('end', () => this._finish(done)); 72 | } 73 | } 74 | } 75 | 76 | 77 | function parser() { 78 | return pumpify.obj( 79 | cprotoParser(), 80 | new MergeDocumentation() 81 | ); 82 | } 83 | 84 | module.exports = parser; 85 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/gdtr.c: -------------------------------------------------------------------------------- 1 | /* gdtr.c 2 | * 3 | * Gamma distribution function 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double a, b, x, y, gdtr(); 10 | * 11 | * y = gdtr( a, b, x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns the integral from zero to x of the gamma probability 18 | * density function: 19 | * 20 | * 21 | * x 22 | * b - 23 | * a | | b-1 -at 24 | * y = ----- | t e dt 25 | * - | | 26 | * | (b) - 27 | * 0 28 | * 29 | * The incomplete gamma integral is used, according to the 30 | * relation 31 | * 32 | * y = igam( b, ax ). 33 | * 34 | * 35 | * ACCURACY: 36 | * 37 | * See igam(). 38 | * 39 | * ERROR MESSAGES: 40 | * 41 | * message condition value returned 42 | * gdtr domain x < 0 0.0 43 | * 44 | */ 45 | /* gdtrc.c 46 | * 47 | * Complemented gamma distribution function 48 | * 49 | * 50 | * 51 | * SYNOPSIS: 52 | * 53 | * double a, b, x, y, gdtrc(); 54 | * 55 | * y = gdtrc( a, b, x ); 56 | * 57 | * 58 | * 59 | * DESCRIPTION: 60 | * 61 | * Returns the integral from x to infinity of the gamma 62 | * probability density function: 63 | * 64 | * 65 | * inf. 66 | * b - 67 | * a | | b-1 -at 68 | * y = ----- | t e dt 69 | * - | | 70 | * | (b) - 71 | * x 72 | * 73 | * The incomplete gamma integral is used, according to the 74 | * relation 75 | * 76 | * y = igamc( b, ax ). 77 | * 78 | * 79 | * ACCURACY: 80 | * 81 | * See igamc(). 82 | * 83 | * ERROR MESSAGES: 84 | * 85 | * message condition value returned 86 | * gdtrc domain x < 0 0.0 87 | * 88 | */ 89 | 90 | /* gdtr() */ 91 | 92 | /* 93 | Cephes Math Library Release 2.8: June, 2000 94 | Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier 95 | */ 96 | 97 | #include "mconf.h" 98 | #ifdef ANSIPROT 99 | extern double igam(double, double); 100 | extern double igamc(double, double); 101 | #else 102 | double igam(), igamc(); 103 | #endif 104 | 105 | double gdtr(a, b, x) double a, b, x; 106 | { 107 | 108 | if (x < 0.0) { 109 | mtherr("gdtr", DOMAIN); 110 | return (0.0); 111 | } 112 | return (igam(b, a * x)); 113 | } 114 | 115 | double gdtrc(a, b, x) double a, b, x; 116 | { 117 | 118 | if (x < 0.0) { 119 | mtherr("gdtrc", DOMAIN); 120 | return (0.0); 121 | } 122 | return (igamc(b, a * x)); 123 | } 124 | -------------------------------------------------------------------------------- /load-testing/index.mjs: -------------------------------------------------------------------------------- 1 | import z from "zod"; 2 | import y from "yup"; 3 | import j from "joi"; 4 | import { run, bench } from "mitata"; 5 | 6 | const payload = { 7 | name: "John Doe", 8 | age: 42, 9 | email: "test@example.com", 10 | address: { 11 | street: "123 Main St", 12 | city: "Anytown", 13 | state: "CA", 14 | zip: "12345", 15 | }, 16 | cars: [ 17 | { 18 | make: "Ford", 19 | model: "F150", 20 | }, 21 | { 22 | make: "Chevy", 23 | model: "Silverado", 24 | }, 25 | ], 26 | }; 27 | 28 | const amount = 1_000; 29 | 30 | const zodSchema = z.object({ 31 | name: z.string(), 32 | age: z.number(), 33 | email: z.string().email(), 34 | address: z.object({ 35 | street: z.string(), 36 | city: z.string(), 37 | state: z.string(), 38 | zip: z.string(), 39 | }), 40 | cars: z.array(z.object({ make: z.string(), model: z.string() })), 41 | }); 42 | 43 | function testZod() { 44 | for (let i = 0; i < amount; i++) { 45 | zodSchema.parse(payload); 46 | } 47 | } 48 | 49 | const yupSchema = y.object({ 50 | name: y.string().required(), 51 | age: y.number().required(), 52 | email: y.string().email(), 53 | address: y.object({ 54 | street: y.string(), 55 | city: y.string(), 56 | state: y.string(), 57 | zip: y.string(), 58 | }), 59 | cars: y.array().of( 60 | y.object({ 61 | make: y.string(), 62 | model: y.string(), 63 | }) 64 | ), 65 | }); 66 | 67 | function testYup() { 68 | for (let i = 0; i < amount; i++) { 69 | yupSchema.validate(payload); 70 | } 71 | } 72 | 73 | const joiSchema = j.object({ 74 | name: j.string().required(), 75 | age: j.number().required(), 76 | email: j.string().email(), 77 | address: j.object({ 78 | street: j.string(), 79 | city: j.string(), 80 | state: j.string(), 81 | zip: j.string(), 82 | }), 83 | cars: j.array().items( 84 | j.object({ 85 | make: j.string(), 86 | model: j.string(), 87 | }) 88 | ), 89 | }); 90 | 91 | function testJoi() { 92 | for (let i = 0; i < amount; i++) { 93 | joiSchema.validate(payload); 94 | } 95 | } 96 | bench(testYup); 97 | bench(testJoi); 98 | bench(testZod); 99 | 100 | await run({ 101 | avg: true, // enable/disable avg column (default: true) 102 | json: false, // enable/disable json output (default: false) 103 | colors: true, // enable/disable colors (default: true) 104 | min_max: true, // enable/disable min/max column (default: true) 105 | collect: false, // enable/disable collecting returned values into an array during the benchmark (default: false) 106 | }); 107 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/autocannon-compare@0.4.0/node_modules/autocannon-compare/test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const test = require('tap').test 4 | const compare = require('.') 5 | const A = require('./fixture-a') 6 | const B = require('./fixture-b') 7 | 8 | test('compare two sets of data', function (t) { 9 | const result = compare(A, B) 10 | 11 | t.comment(JSON.stringify(result.requests)) 12 | t.ok(result.requests, 'requests exists') 13 | t.equal(result.requests.difference, '980.33%') 14 | t.equal(result.requests.significant, '***') 15 | 16 | t.comment(JSON.stringify(result.throughput)) 17 | t.ok(result.throughput, 'requests exists') 18 | t.equal(result.throughput.difference, '976.68%') 19 | t.equal(result.throughput.significant, '***') 20 | 21 | t.comment(JSON.stringify(result.latency)) 22 | t.ok(result.latency, 'requests exists') 23 | t.equal(result.latency.difference, '-98.91%') 24 | t.equal(result.latency.significant, '***') 25 | 26 | t.ok(result.aWins) 27 | t.notOk(result.bWins) 28 | t.notOk(result.equal) 29 | 30 | t.end() 31 | }) 32 | 33 | test('compare with itself', function (t) { 34 | const result = compare(A, A) 35 | 36 | t.comment(JSON.stringify(result.requests)) 37 | t.ok(result.requests, 'requests exists') 38 | t.equal(result.requests.difference, '0%') 39 | t.equal(result.requests.significant, '') 40 | 41 | t.comment(JSON.stringify(result.throughput)) 42 | t.ok(result.throughput, 'requests exists') 43 | t.equal(result.throughput.difference, '0%') 44 | t.equal(result.throughput.significant, '') 45 | 46 | t.comment(JSON.stringify(result.latency)) 47 | t.ok(result.latency, 'requests exists') 48 | t.equal(result.latency.difference, '0%') 49 | t.equal(result.latency.significant, '') 50 | 51 | t.notOk(result.aWins) 52 | t.notOk(result.bWins) 53 | t.ok(result.equal) 54 | 55 | t.end() 56 | }) 57 | 58 | test('compare reverse two sets of data', function (t) { 59 | const result = compare(B, A) 60 | 61 | t.comment(JSON.stringify(result.requests)) 62 | t.ok(result.requests, 'requests exists') 63 | t.equal(result.requests.difference, '-90.74%') 64 | t.equal(result.requests.significant, '***') 65 | 66 | t.comment(JSON.stringify(result.throughput)) 67 | t.ok(result.throughput, 'requests exists') 68 | t.equal(result.throughput.difference, '-90.71%') 69 | t.equal(result.throughput.significant, '***') 70 | 71 | t.comment(JSON.stringify(result.latency)) 72 | t.ok(result.latency, 'requests exists') 73 | t.equal(result.latency.difference, '9083.33%') 74 | t.equal(result.latency.significant, '***') 75 | 76 | t.notOk(result.aWins) 77 | t.ok(result.bWins) 78 | t.notOk(result.equal) 79 | 80 | t.end() 81 | }) 82 | -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/reporter/table.mjs: -------------------------------------------------------------------------------- 1 | import * as kleur from './clr.mjs'; 2 | import { duration } from './fmt.mjs'; 3 | 4 | export function size(names) { 5 | let max = 9; 6 | for (const name of names) if (max < name.length) max = name.length; 7 | 8 | return 2 + max; 9 | } 10 | 11 | export function br({ size, avg = true, min_max = true, percentiles = true }) { 12 | return '-'.repeat(size + 14 * avg + 24 * min_max) + (!percentiles ? '' : ' ' + '-'.repeat(9 + 10 + 10)); 13 | } 14 | 15 | export function benchmark_error(n, e, { size, avg = true, colors = true, min_max = true, percentiles = true }) { 16 | return n.padEnd(size, ' ') + `${kleur.red(colors, 'error')}: ${e.message}${e.stack ? '\n' + kleur.gray(colors, e.stack) : ''}`; 17 | } 18 | 19 | export function header({ size, avg = true, min_max = true, percentiles = true }) { 20 | return 'benchmark'.padEnd(size, ' ') 21 | + (!avg ? '' : 'time (avg)'.padStart(14, ' ')) 22 | + (!min_max ? '' : '(min … max)'.padStart(24, ' ')) 23 | + (!percentiles ? '' : ` ${'p75'.padStart(9, ' ')} ${'p99'.padStart(9, ' ')} ${'p995'.padStart(9, ' ')}`); 24 | } 25 | 26 | export function benchmark(n, b, { size, avg = true, colors = true, min_max = true, percentiles = true }) { 27 | return n.padEnd(size, ' ') 28 | + (!avg ? '' : `${kleur.yellow(colors, duration(b.avg))}/iter`.padStart(14 + 10 * colors, ' ')) 29 | + (!min_max ? '' : `(${kleur.cyan(colors, duration(b.min))} … ${kleur.magenta(colors, duration(b.max))})`.padStart(24 + 2 * 10 * colors, ' ')) 30 | + (!percentiles ? '' : ` ${kleur.gray(colors, duration(b.p75)).padStart(9 + 10 * colors, ' ')} ${kleur.gray(colors, duration(b.p99)).padStart(9 + 10 * colors, ' ')} ${kleur.gray(colors, duration(b.p995)).padStart(9 + 10 * colors, ' ')}`); 31 | } 32 | 33 | export function summary(benchmarks, { colors = true } = {}) { 34 | benchmarks = benchmarks.filter(b => !b.error); 35 | benchmarks.sort((a, b) => a.stats.avg - b.stats.avg); 36 | const baseline = benchmarks.find(b => b.baseline) || benchmarks[0]; 37 | 38 | return kleur.bold(colors, 'summary') + ((null == baseline.group || baseline.group.startsWith?.('$mitata_group')) ? '' : kleur.gray(colors, ` for ${baseline.group}`)) 39 | + `\n ${kleur.bold(colors, kleur.cyan(colors, baseline.name))}` 40 | 41 | + benchmarks.filter(b => b !== baseline).map(b => { 42 | const diff = Number((1 / baseline.stats.avg * b.stats.avg).toFixed(2)); 43 | const inv_diff = Number((1 / b.stats.avg * baseline.stats.avg).toFixed(2)); 44 | return `\n ${kleur[1 > diff ? 'red' : 'green'](colors, 1 <= diff ? diff : inv_diff)}x ${1 > diff ? 'slower' : 'faster'} than ${kleur.bold(colors, kleur.cyan(colors, b.name))}`; 45 | }).join(''); 46 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/reporter/table.mjs: -------------------------------------------------------------------------------- 1 | import * as kleur from './clr.mjs'; 2 | import { duration } from './fmt.mjs'; 3 | 4 | export function size(names) { 5 | let max = 9; 6 | for (const name of names) if (max < name.length) max = name.length; 7 | 8 | return 2 + max; 9 | } 10 | 11 | export function br({ size, avg = true, min_max = true, percentiles = true }) { 12 | return '-'.repeat(size + 14 * avg + 24 * min_max) + (!percentiles ? '' : ' ' + '-'.repeat(9 + 10 + 10)); 13 | } 14 | 15 | export function benchmark_error(n, e, { size, avg = true, colors = true, min_max = true, percentiles = true }) { 16 | return n.padEnd(size, ' ') + `${kleur.red(colors, 'error')}: ${e.message}${e.stack ? '\n' + kleur.gray(colors, e.stack) : ''}`; 17 | } 18 | 19 | export function header({ size, avg = true, min_max = true, percentiles = true }) { 20 | return 'benchmark'.padEnd(size, ' ') 21 | + (!avg ? '' : 'time (avg)'.padStart(14, ' ')) 22 | + (!min_max ? '' : '(min … max)'.padStart(24, ' ')) 23 | + (!percentiles ? '' : ` ${'p75'.padStart(9, ' ')} ${'p99'.padStart(9, ' ')} ${'p995'.padStart(9, ' ')}`); 24 | } 25 | 26 | export function benchmark(n, b, { size, avg = true, colors = true, min_max = true, percentiles = true }) { 27 | return n.padEnd(size, ' ') 28 | + (!avg ? '' : `${kleur.yellow(colors, duration(b.avg))}/iter`.padStart(14 + 10 * colors, ' ')) 29 | + (!min_max ? '' : `(${kleur.cyan(colors, duration(b.min))} … ${kleur.magenta(colors, duration(b.max))})`.padStart(24 + 2 * 10 * colors, ' ')) 30 | + (!percentiles ? '' : ` ${kleur.gray(colors, duration(b.p75)).padStart(9 + 10 * colors, ' ')} ${kleur.gray(colors, duration(b.p99)).padStart(9 + 10 * colors, ' ')} ${kleur.gray(colors, duration(b.p995)).padStart(9 + 10 * colors, ' ')}`); 31 | } 32 | 33 | export function summary(benchmarks, { colors = true } = {}) { 34 | benchmarks = benchmarks.filter(b => !b.error); 35 | benchmarks.sort((a, b) => a.stats.avg - b.stats.avg); 36 | const baseline = benchmarks.find(b => b.baseline) || benchmarks[0]; 37 | 38 | return kleur.bold(colors, 'summary') + ((null == baseline.group || baseline.group.startsWith?.('$mitata_group')) ? '' : kleur.gray(colors, ` for ${baseline.group}`)) 39 | + `\n ${kleur.bold(colors, kleur.cyan(colors, baseline.name))}` 40 | 41 | + benchmarks.filter(b => b !== baseline).map(b => { 42 | const diff = Number((1 / baseline.stats.avg * b.stats.avg).toFixed(2)); 43 | const inv_diff = Number((1 / b.stats.avg * baseline.stats.avg).toFixed(2)); 44 | return `\n ${kleur[1 > diff ? 'red' : 'green'](colors, 1 <= diff ? diff : inv_diff)}x ${1 > diff ? 'slower' : 'faster'} than ${kleur.bold(colors, kleur.cyan(colors, b.name))}`; 45 | }).join(''); 46 | } -------------------------------------------------------------------------------- /load-testing/node_modules/.ignored/mitata/reporter/clr.mjs: -------------------------------------------------------------------------------- 1 | // https://github.com/lukeed/kleur/blob/598f24cb7f5054b7c504e9ab89251305311131b1/colors.mjs 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) Luke Edwards (lukeed.com) 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | function init(x, y) { 26 | let rgx = new RegExp(`\\x1b\\[${y}m`, 'g'); 27 | let open = `\x1b[${x}m`, close = `\x1b[${y}m`; 28 | 29 | return function (e, txt) { 30 | if (!e || txt == null) return txt; 31 | return open + (!!~('' + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close; 32 | }; 33 | } 34 | 35 | // modifiers 36 | export const reset = init(0, 0); 37 | export const bold = init(1, 22); 38 | export const dim = init(2, 22); 39 | export const italic = init(3, 23); 40 | export const underline = init(4, 24); 41 | export const inverse = init(7, 27); 42 | export const hidden = init(8, 28); 43 | export const strikethrough = init(9, 29); 44 | 45 | // colors 46 | export const black = init(30, 39); 47 | export const red = init(31, 39); 48 | export const green = init(32, 39); 49 | export const yellow = init(33, 39); 50 | export const blue = init(34, 39); 51 | export const magenta = init(35, 39); 52 | export const cyan = init(36, 39); 53 | export const white = init(37, 39); 54 | export const gray = init(90, 39); 55 | 56 | // background colors 57 | export const bgBlack = init(40, 49); 58 | export const bgRed = init(41, 49); 59 | export const bgGreen = init(42, 49); 60 | export const bgYellow = init(43, 49); 61 | export const bgBlue = init(44, 49); 62 | export const bgMagenta = init(45, 49); 63 | export const bgCyan = init(46, 49); 64 | export const bgWhite = init(47, 49); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/mitata@0.1.6/node_modules/mitata/reporter/clr.mjs: -------------------------------------------------------------------------------- 1 | // https://github.com/lukeed/kleur/blob/598f24cb7f5054b7c504e9ab89251305311131b1/colors.mjs 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) Luke Edwards (lukeed.com) 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | function init(x, y) { 26 | let rgx = new RegExp(`\\x1b\\[${y}m`, 'g'); 27 | let open = `\x1b[${x}m`, close = `\x1b[${y}m`; 28 | 29 | return function (e, txt) { 30 | if (!e || txt == null) return txt; 31 | return open + (!!~('' + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close; 32 | }; 33 | } 34 | 35 | // modifiers 36 | export const reset = init(0, 0); 37 | export const bold = init(1, 22); 38 | export const dim = init(2, 22); 39 | export const italic = init(3, 23); 40 | export const underline = init(4, 24); 41 | export const inverse = init(7, 27); 42 | export const hidden = init(8, 28); 43 | export const strikethrough = init(9, 29); 44 | 45 | // colors 46 | export const black = init(30, 39); 47 | export const red = init(31, 39); 48 | export const green = init(32, 39); 49 | export const yellow = init(33, 39); 50 | export const blue = init(34, 39); 51 | export const magenta = init(35, 39); 52 | export const cyan = init(36, 39); 53 | export const white = init(37, 39); 54 | export const gray = init(90, 39); 55 | 56 | // background colors 57 | export const bgBlack = init(40, 49); 58 | export const bgRed = init(41, 49); 59 | export const bgGreen = init(42, 49); 60 | export const bgYellow = init(43, 49); 61 | export const bgBlue = init(44, 49); 62 | export const bgMagenta = init(45, 49); 63 | export const bgCyan = init(46, 49); 64 | export const bgWhite = init(47, 49); -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/jn.c: -------------------------------------------------------------------------------- 1 | /* jn.c 2 | * 3 | * Bessel function of integer order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * int n; 10 | * double x, y, jn(); 11 | * 12 | * y = jn( n, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns Bessel function of order n, where n is a 19 | * (possibly negative) integer. 20 | * 21 | * The ratio of jn(x) to j0(x) is computed by backward 22 | * recurrence. First the ratio jn/jn-1 is found by a 23 | * continued fraction expansion. Then the recurrence 24 | * relating successive orders is applied until j0 or j1 is 25 | * reached. 26 | * 27 | * If n = 0 or 1 the routine for j0 or j1 is called 28 | * directly. 29 | * 30 | * 31 | * 32 | * ACCURACY: 33 | * 34 | * Absolute error: 35 | * arithmetic range # trials peak rms 36 | * DEC 0, 30 5500 6.9e-17 9.3e-18 37 | * IEEE 0, 30 5000 4.4e-16 7.9e-17 38 | * 39 | * 40 | * Not suitable for large n or x. Use jv() instead. 41 | * 42 | */ 43 | 44 | /* jn.c 45 | Cephes Math Library Release 2.8: June, 2000 46 | Copyright 1984, 1987, 2000 by Stephen L. Moshier 47 | */ 48 | #include "mconf.h" 49 | #ifdef ANSIPROT 50 | extern double fabs(double); 51 | extern double j0(double); 52 | extern double j1(double); 53 | #else 54 | double fabs(), j0(), j1(); 55 | #endif 56 | extern double MACHEP; 57 | 58 | double jn(n, x) int n; 59 | double x; 60 | { 61 | double pkm2, pkm1, pk, xk, r, ans; 62 | int k, sign; 63 | 64 | if (n < 0) { 65 | n = -n; 66 | if ((n & 1) == 0) /* -1**n */ 67 | sign = 1; 68 | else 69 | sign = -1; 70 | } else 71 | sign = 1; 72 | 73 | if (x < 0.0) { 74 | if (n & 1) 75 | sign = -sign; 76 | x = -x; 77 | } 78 | 79 | if (n == 0) 80 | return (sign * j0(x)); 81 | if (n == 1) 82 | return (sign * j1(x)); 83 | if (n == 2) 84 | return (sign * (2.0 * j1(x) / x - j0(x))); 85 | 86 | if (x < MACHEP) 87 | return (0.0); 88 | 89 | /* continued fraction */ 90 | #ifdef DEC 91 | k = 56; 92 | #else 93 | k = 53; 94 | #endif 95 | 96 | pk = 2 * (n + k); 97 | ans = pk; 98 | xk = x * x; 99 | 100 | do { 101 | pk -= 2.0; 102 | ans = pk - (xk / ans); 103 | } while (--k > 0); 104 | ans = x / ans; 105 | 106 | /* backward recurrence */ 107 | 108 | pk = 1.0; 109 | pkm1 = 1.0 / ans; 110 | k = n - 1; 111 | r = 2 * k; 112 | 113 | do { 114 | pkm2 = (pkm1 * r - pk * x) / x; 115 | pk = pkm1; 116 | pkm1 = pkm2; 117 | r -= 2.0; 118 | } while (--k > 0); 119 | 120 | if (fabs(pk) > fabs(pkm1)) 121 | ans = j1(x) / pk; 122 | else 123 | ans = j0(x) / pkm1; 124 | return (sign * ans); 125 | } 126 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/jn.c: -------------------------------------------------------------------------------- 1 | /* jn.c 2 | * 3 | * Bessel function of integer order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * int n; 10 | * double x, y, jn(); 11 | * 12 | * y = jn( n, x ); 13 | * 14 | * 15 | * 16 | * DESCRIPTION: 17 | * 18 | * Returns Bessel function of order n, where n is a 19 | * (possibly negative) integer. 20 | * 21 | * The ratio of jn(x) to j0(x) is computed by backward 22 | * recurrence. First the ratio jn/jn-1 is found by a 23 | * continued fraction expansion. Then the recurrence 24 | * relating successive orders is applied until j0 or j1 is 25 | * reached. 26 | * 27 | * If n = 0 or 1 the routine for j0 or j1 is called 28 | * directly. 29 | * 30 | * 31 | * 32 | * ACCURACY: 33 | * 34 | * Absolute error: 35 | * arithmetic range # trials peak rms 36 | * DEC 0, 30 5500 6.9e-17 9.3e-18 37 | * IEEE 0, 30 5000 4.4e-16 7.9e-17 38 | * 39 | * 40 | * Not suitable for large n or x. Use jv() instead. 41 | * 42 | */ 43 | 44 | /* jn.c 45 | Cephes Math Library Release 2.8: June, 2000 46 | Copyright 1984, 1987, 2000 by Stephen L. Moshier 47 | */ 48 | #include "mconf.h" 49 | #ifdef ANSIPROT 50 | extern double fabs(double); 51 | extern double j0(double); 52 | extern double j1(double); 53 | #else 54 | double fabs(), j0(), j1(); 55 | #endif 56 | extern double MACHEP; 57 | 58 | double jn(n, x) int n; 59 | double x; 60 | { 61 | double pkm2, pkm1, pk, xk, r, ans; 62 | int k, sign; 63 | 64 | if (n < 0) { 65 | n = -n; 66 | if ((n & 1) == 0) /* -1**n */ 67 | sign = 1; 68 | else 69 | sign = -1; 70 | } else 71 | sign = 1; 72 | 73 | if (x < 0.0) { 74 | if (n & 1) 75 | sign = -sign; 76 | x = -x; 77 | } 78 | 79 | if (n == 0) 80 | return (sign * j0(x)); 81 | if (n == 1) 82 | return (sign * j1(x)); 83 | if (n == 2) 84 | return (sign * (2.0 * j1(x) / x - j0(x))); 85 | 86 | if (x < MACHEP) 87 | return (0.0); 88 | 89 | /* continued fraction */ 90 | #ifdef DEC 91 | k = 56; 92 | #else 93 | k = 53; 94 | #endif 95 | 96 | pk = 2 * (n + k); 97 | ans = pk; 98 | xk = x * x; 99 | 100 | do { 101 | pk -= 2.0; 102 | ans = pk - (xk / ans); 103 | } while (--k > 0); 104 | ans = x / ans; 105 | 106 | /* backward recurrence */ 107 | 108 | pk = 1.0; 109 | pkm1 = 1.0 / ans; 110 | k = n - 1; 111 | r = 2 * k; 112 | 113 | do { 114 | pkm2 = (pkm1 * r - pk * x) / x; 115 | pk = pkm1; 116 | pkm1 = pkm2; 117 | r -= 2.0; 118 | } while (--k > 0); 119 | 120 | if (fabs(pk) > fabs(pkm1)) 121 | ans = j1(x) / pk; 122 | else 123 | ans = j0(x) / pkm1; 124 | return (sign * ans); 125 | } 126 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/cephes/iv.c: -------------------------------------------------------------------------------- 1 | /* iv.c 2 | * 3 | * Modified Bessel function of noninteger order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double v, x, y, iv(); 10 | * 11 | * y = iv( v, x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns modified Bessel function of order v of the 18 | * argument. If x is negative, v must be integer valued. 19 | * 20 | * The function is defined as Iv(x) = Jv( ix ). It is 21 | * here computed in terms of the confluent hypergeometric 22 | * function, according to the formula 23 | * 24 | * v -x 25 | * Iv(x) = (x/2) e hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1) 26 | * 27 | * If v is a negative integer, then v is replaced by -v. 28 | * 29 | * 30 | * ACCURACY: 31 | * 32 | * Tested at random points (v, x), with v between 0 and 33 | * 30, x between 0 and 28. 34 | * Relative error: 35 | * arithmetic domain # trials peak rms 36 | * DEC 0,30 2000 3.1e-15 5.4e-16 37 | * IEEE 0,30 10000 1.7e-14 2.7e-15 38 | * 39 | * Accuracy is diminished if v is near a negative integer. 40 | * 41 | * See also hyperg.c. 42 | * 43 | */ 44 | /* iv.c */ 45 | /* Modified Bessel function of noninteger order */ 46 | /* If x < 0, then v must be an integer. */ 47 | 48 | /* 49 | Cephes Math Library Release 2.8: June, 2000 50 | Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier 51 | */ 52 | 53 | #include "mconf.h" 54 | #ifdef ANSIPROT 55 | extern double hyperg(double, double, double); 56 | extern double exp(double); 57 | extern double gamma(double); 58 | extern double log(double); 59 | extern double fabs(double); 60 | extern double floor(double); 61 | #else 62 | double hyperg(), exp(), gamma(), log(), fabs(), floor(); 63 | #endif 64 | extern double MACHEP, MAXNUM; 65 | 66 | double iv(v, x) double v, x; 67 | { 68 | int sign; 69 | double t, ax; 70 | 71 | /* If v is a negative integer, invoke symmetry */ 72 | t = floor(v); 73 | if (v < 0.0) { 74 | if (t == v) { 75 | v = -v; /* symmetry */ 76 | t = -t; 77 | } 78 | } 79 | /* If x is negative, require v to be an integer */ 80 | sign = 1; 81 | if (x < 0.0) { 82 | if (t != v) { 83 | mtherr("iv", DOMAIN); 84 | return (0.0); 85 | } 86 | if (v != 2.0 * floor(v / 2.0)) 87 | sign = -1; 88 | } 89 | 90 | /* Avoid logarithm singularity */ 91 | if (x == 0.0) { 92 | if (v == 0.0) 93 | return (1.0); 94 | if (v < 0.0) { 95 | mtherr("iv", OVERFLOW); 96 | return (MAXNUM); 97 | } else 98 | return (0.0); 99 | } 100 | 101 | ax = fabs(x); 102 | t = v * log(0.5 * ax) - x; 103 | t = sign * exp(t) / gamma(v + 1.0); 104 | ax = v + 0.5; 105 | return (t * hyperg(ax, 2.0 * ax, 2.0 * x)); 106 | } 107 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/cephes/iv.c: -------------------------------------------------------------------------------- 1 | /* iv.c 2 | * 3 | * Modified Bessel function of noninteger order 4 | * 5 | * 6 | * 7 | * SYNOPSIS: 8 | * 9 | * double v, x, y, iv(); 10 | * 11 | * y = iv( v, x ); 12 | * 13 | * 14 | * 15 | * DESCRIPTION: 16 | * 17 | * Returns modified Bessel function of order v of the 18 | * argument. If x is negative, v must be integer valued. 19 | * 20 | * The function is defined as Iv(x) = Jv( ix ). It is 21 | * here computed in terms of the confluent hypergeometric 22 | * function, according to the formula 23 | * 24 | * v -x 25 | * Iv(x) = (x/2) e hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1) 26 | * 27 | * If v is a negative integer, then v is replaced by -v. 28 | * 29 | * 30 | * ACCURACY: 31 | * 32 | * Tested at random points (v, x), with v between 0 and 33 | * 30, x between 0 and 28. 34 | * Relative error: 35 | * arithmetic domain # trials peak rms 36 | * DEC 0,30 2000 3.1e-15 5.4e-16 37 | * IEEE 0,30 10000 1.7e-14 2.7e-15 38 | * 39 | * Accuracy is diminished if v is near a negative integer. 40 | * 41 | * See also hyperg.c. 42 | * 43 | */ 44 | /* iv.c */ 45 | /* Modified Bessel function of noninteger order */ 46 | /* If x < 0, then v must be an integer. */ 47 | 48 | /* 49 | Cephes Math Library Release 2.8: June, 2000 50 | Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier 51 | */ 52 | 53 | #include "mconf.h" 54 | #ifdef ANSIPROT 55 | extern double hyperg(double, double, double); 56 | extern double exp(double); 57 | extern double gamma(double); 58 | extern double log(double); 59 | extern double fabs(double); 60 | extern double floor(double); 61 | #else 62 | double hyperg(), exp(), gamma(), log(), fabs(), floor(); 63 | #endif 64 | extern double MACHEP, MAXNUM; 65 | 66 | double iv(v, x) double v, x; 67 | { 68 | int sign; 69 | double t, ax; 70 | 71 | /* If v is a negative integer, invoke symmetry */ 72 | t = floor(v); 73 | if (v < 0.0) { 74 | if (t == v) { 75 | v = -v; /* symmetry */ 76 | t = -t; 77 | } 78 | } 79 | /* If x is negative, require v to be an integer */ 80 | sign = 1; 81 | if (x < 0.0) { 82 | if (t != v) { 83 | mtherr("iv", DOMAIN); 84 | return (0.0); 85 | } 86 | if (v != 2.0 * floor(v / 2.0)) 87 | sign = -1; 88 | } 89 | 90 | /* Avoid logarithm singularity */ 91 | if (x == 0.0) { 92 | if (v == 0.0) 93 | return (1.0); 94 | if (v < 0.0) { 95 | mtherr("iv", OVERFLOW); 96 | return (MAXNUM); 97 | } else 98 | return (0.0); 99 | } 100 | 101 | ax = fabs(x); 102 | t = v * log(0.5 * ax) - x; 103 | t = sign * exp(t) / gamma(v + 1.0); 104 | ax = v + 0.5; 105 | return (t * hyperg(ax, 2.0 * ax, 2.0 * x)); 106 | } 107 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/cephes@1.2.0/node_modules/cephes/article/style.css: -------------------------------------------------------------------------------- 1 | 2 | #ar-walkthrough .ar-walkthrough-step { 3 | min-height: 20px; 4 | } 5 | 6 | #ar-walkthrough .ar-walkthrough-step { 7 | display: none; 8 | grid-template-columns: 48px 1fr; 9 | grid-template-rows: auto auto; 10 | grid-template-areas: 11 | "number text" 12 | ". warning"; 13 | grid-column-gap: 10px; 14 | } 15 | #ar-walkthrough .ar-walkthrough-step.ar-walkthrough-selected { 16 | display: grid; 17 | } 18 | 19 | #ar-walkthrough .ar-walkthrough-step .ar-walkthrough-number { 20 | grid-area: number; 21 | 22 | width: 48px; 23 | height: 48px; 24 | background: #E7C9F6; 25 | border-radius: 100%; 26 | text-align: center; 27 | line-height: 48px; 28 | font-size: 1.5em; 29 | } 30 | 31 | #ar-walkthrough .ar-walkthrough-step .ar-walkthrough-text { 32 | grid-area: text; 33 | margin: 0; 34 | } 35 | 36 | #ar-walkthrough .ar-walkthrough-pages { 37 | display: grid; 38 | grid-column-gap: 10px; 39 | grid-auto-flow: column; 40 | justify-content: center; 41 | margin: 1em 0 0.5em 0; 42 | } 43 | 44 | #ar-walkthrough .ar-walkthrough-pages .ar-walkthrough-page { 45 | height: 25px; 46 | width: 25px; 47 | background: #E7C9F6; 48 | border-radius: 100%; 49 | text-align: center; 50 | line-height: 25px; 51 | font-size: 0.7em; 52 | cursor: pointer; 53 | } 54 | 55 | /* */ 56 | 57 | #ar-line-graph svg .tick text { 58 | font-size: 14px; 59 | fill: #505050; 60 | } 61 | 62 | #ar-line-graph svg .tick line { 63 | stroke-width: 2; 64 | stroke: #505050; 65 | } 66 | 67 | #ar-line-graph svg .background { 68 | fill: #EBEBEB; 69 | } 70 | 71 | #ar-line-graph svg .axis-title text { 72 | transform: rotate(90deg); 73 | text-anchor: middle; 74 | fill: #505050; 75 | } 76 | 77 | #ar-line-graph svg .grid line { 78 | stroke: #fff; 79 | stroke-width: 2; 80 | } 81 | 82 | #ar-line-graph svg .grid .minor line { 83 | stroke-opacity: .5; 84 | } 85 | 86 | #ar-line-graph svg .grid text { 87 | display: none; 88 | } 89 | 90 | #ar-line-graph svg .axis path, 91 | #ar-line-graph svg .grid path { 92 | display: none; 93 | } 94 | 95 | #ar-line-graph svg .lines .mathline { 96 | fill: none; 97 | stroke-width: 1px; 98 | } 99 | 100 | #ar-line-graph .legend { 101 | display: grid; 102 | margin-bottom: 10px; 103 | grid-gap: 5px; 104 | } 105 | 106 | #ar-line-graph .legend svg.legend-item { 107 | display: block; 108 | } 109 | 110 | #ar-line-graph .legend svg.legend-item .legend-background { 111 | fill: #EBEBEB; 112 | } 113 | 114 | #ar-line-graph .legend svg.legend-item .legend-color { 115 | text-anchor: middle; 116 | alignment-baseline: middle; 117 | dominant-baseline: middle; 118 | font: 12px sans-serif; 119 | } 120 | 121 | #ar-line-graph .legend svg.legend-item .legend-text { 122 | text-anchor: start; 123 | alignment-baseline: middle; 124 | dominant-baseline: middle; 125 | font: 12px sans-serif; 126 | } 127 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/distributions@2.1.0/node_modules/cephes/article/style.css: -------------------------------------------------------------------------------- 1 | 2 | #ar-walkthrough .ar-walkthrough-step { 3 | min-height: 20px; 4 | } 5 | 6 | #ar-walkthrough .ar-walkthrough-step { 7 | display: none; 8 | grid-template-columns: 48px 1fr; 9 | grid-template-rows: auto auto; 10 | grid-template-areas: 11 | "number text" 12 | ". warning"; 13 | grid-column-gap: 10px; 14 | } 15 | #ar-walkthrough .ar-walkthrough-step.ar-walkthrough-selected { 16 | display: grid; 17 | } 18 | 19 | #ar-walkthrough .ar-walkthrough-step .ar-walkthrough-number { 20 | grid-area: number; 21 | 22 | width: 48px; 23 | height: 48px; 24 | background: #E7C9F6; 25 | border-radius: 100%; 26 | text-align: center; 27 | line-height: 48px; 28 | font-size: 1.5em; 29 | } 30 | 31 | #ar-walkthrough .ar-walkthrough-step .ar-walkthrough-text { 32 | grid-area: text; 33 | margin: 0; 34 | } 35 | 36 | #ar-walkthrough .ar-walkthrough-pages { 37 | display: grid; 38 | grid-column-gap: 10px; 39 | grid-auto-flow: column; 40 | justify-content: center; 41 | margin: 1em 0 0.5em 0; 42 | } 43 | 44 | #ar-walkthrough .ar-walkthrough-pages .ar-walkthrough-page { 45 | height: 25px; 46 | width: 25px; 47 | background: #E7C9F6; 48 | border-radius: 100%; 49 | text-align: center; 50 | line-height: 25px; 51 | font-size: 0.7em; 52 | cursor: pointer; 53 | } 54 | 55 | /* */ 56 | 57 | #ar-line-graph svg .tick text { 58 | font-size: 14px; 59 | fill: #505050; 60 | } 61 | 62 | #ar-line-graph svg .tick line { 63 | stroke-width: 2; 64 | stroke: #505050; 65 | } 66 | 67 | #ar-line-graph svg .background { 68 | fill: #EBEBEB; 69 | } 70 | 71 | #ar-line-graph svg .axis-title text { 72 | transform: rotate(90deg); 73 | text-anchor: middle; 74 | fill: #505050; 75 | } 76 | 77 | #ar-line-graph svg .grid line { 78 | stroke: #fff; 79 | stroke-width: 2; 80 | } 81 | 82 | #ar-line-graph svg .grid .minor line { 83 | stroke-opacity: .5; 84 | } 85 | 86 | #ar-line-graph svg .grid text { 87 | display: none; 88 | } 89 | 90 | #ar-line-graph svg .axis path, 91 | #ar-line-graph svg .grid path { 92 | display: none; 93 | } 94 | 95 | #ar-line-graph svg .lines .mathline { 96 | fill: none; 97 | stroke-width: 1px; 98 | } 99 | 100 | #ar-line-graph .legend { 101 | display: grid; 102 | margin-bottom: 10px; 103 | grid-gap: 5px; 104 | } 105 | 106 | #ar-line-graph .legend svg.legend-item { 107 | display: block; 108 | } 109 | 110 | #ar-line-graph .legend svg.legend-item .legend-background { 111 | fill: #EBEBEB; 112 | } 113 | 114 | #ar-line-graph .legend svg.legend-item .legend-color { 115 | text-anchor: middle; 116 | alignment-baseline: middle; 117 | dominant-baseline: middle; 118 | font: 12px sans-serif; 119 | } 120 | 121 | #ar-line-graph .legend svg.legend-item .legend-text { 122 | text-anchor: start; 123 | alignment-baseline: middle; 124 | dominant-baseline: middle; 125 | font: 12px sans-serif; 126 | } 127 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/summary@0.3.2/node_modules/summary/README.md: -------------------------------------------------------------------------------- 1 | #summary 2 | 3 | > Takes an array of numbers and calculates some descriptive statistics 4 | 5 | ## Installation 6 | 7 | ```sheel 8 | npm install summary 9 | ``` 10 | 11 | ## Example 12 | 13 | ```javascript 14 | var summary = require('summary'); 15 | 16 | var data = summary([-1, 0, 1], true /* sorted */); 17 | console.log(data.variance()); // 1 18 | console.log(data.mean()); // 0 19 | ``` 20 | 21 | ## Documentation 22 | 23 | The `summary` constructor, takes a required `data` array and and optional 24 | boolean indication whether or not the `data` is `sorted` from small to big, 25 | by default `sorted` is `false`. 26 | 27 | ```javascript 28 | // Data is sorted from small to big 29 | var data = summary([-1, 0, 1], true); 30 | 31 | // Data is sorted, but summary dosn't know. Works fine just a bit slower. 32 | var data = summary([-1, 0, 1] /*, default false */); 33 | 34 | // Data is sorted in reverse order 35 | var data = summary([1, 0, -1] /*, default false */); 36 | 37 | // Data isn't sorted 38 | var data = summary([0, 1, -1] /*, default false */); 39 | ``` 40 | 41 | The data object has the following metods, note that almost all values is lazy 42 | calculated and then cached. 43 | 44 | ```javascript 45 | data.sort(); // Returns the sorted array 46 | 47 | data.size(); // Returns the data length 48 | 49 | data.sum(); // Returns the data sum 50 | 51 | data.mode(); // Returns mode 52 | 53 | data.mean(); // Returns the mean 54 | 55 | data.quartile(0.25); // Returns 25% quartile 56 | 57 | data.median(); // Returns the median 58 | 59 | data.variance(); // Returns the variance 60 | 61 | data.sd(); // Returns the standard deviation 62 | 63 | data.max(); // Returns the maximum value 64 | data.min(); // Returns the minimum value 65 | ``` 66 | 67 | ##License 68 | 69 | **The software is license under "MIT"** 70 | 71 | > Copyright (c) 2013 Andreas Madsen 72 | > 73 | > Permission is hereby granted, free of charge, to any person obtaining a copy 74 | > of this software and associated documentation files (the "Software"), to deal 75 | > in the Software without restriction, including without limitation the rights 76 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 77 | > copies of the Software, and to permit persons to whom the Software is 78 | > furnished to do so, subject to the following conditions: 79 | > 80 | > The above copyright notice and this permission notice shall be included in 81 | > all copies or substantial portions of the Software. 82 | > 83 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 84 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 85 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 86 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 87 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 88 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 89 | > THE SOFTWARE. 90 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/summary/README.md: -------------------------------------------------------------------------------- 1 | #summary 2 | 3 | > Takes an array of numbers and calculates some descriptive statistics 4 | 5 | ## Installation 6 | 7 | ```sheel 8 | npm install summary 9 | ``` 10 | 11 | ## Example 12 | 13 | ```javascript 14 | var summary = require('summary'); 15 | 16 | var data = summary([-1, 0, 1], true /* sorted */); 17 | console.log(data.variance()); // 1 18 | console.log(data.mean()); // 0 19 | ``` 20 | 21 | ## Documentation 22 | 23 | The `summary` constructor, takes a required `data` array and and optional 24 | boolean indication whether or not the `data` is `sorted` from small to big, 25 | by default `sorted` is `false`. 26 | 27 | ```javascript 28 | // Data is sorted from small to big 29 | var data = summary([-1, 0, 1], true); 30 | 31 | // Data is sorted, but summary dosn't know. Works fine just a bit slower. 32 | var data = summary([-1, 0, 1] /*, default false */); 33 | 34 | // Data is sorted in reverse order 35 | var data = summary([1, 0, -1] /*, default false */); 36 | 37 | // Data isn't sorted 38 | var data = summary([0, 1, -1] /*, default false */); 39 | ``` 40 | 41 | The data object has the following metods, note that almost all values is lazy 42 | calculated and then cached. 43 | 44 | ```javascript 45 | data.sort(); // Returns the sorted array 46 | 47 | data.size(); // Returns the data length 48 | 49 | data.sum(); // Returns the data sum 50 | 51 | data.mode(); // Returns mode 52 | 53 | data.mean(); // Returns the mean 54 | 55 | data.quartile(0.25); // Returns 25% quartile 56 | 57 | data.median(); // Returns the median 58 | 59 | data.variance(); // Returns the variance 60 | 61 | data.sd(); // Returns the standard deviation 62 | 63 | data.max(); // Returns the maximum value 64 | data.min(); // Returns the minimum value 65 | ``` 66 | 67 | ##License 68 | 69 | **The software is license under "MIT"** 70 | 71 | > Copyright (c) 2013 Andreas Madsen 72 | > 73 | > Permission is hereby granted, free of charge, to any person obtaining a copy 74 | > of this software and associated documentation files (the "Software"), to deal 75 | > in the Software without restriction, including without limitation the rights 76 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 77 | > copies of the Software, and to permit persons to whom the Software is 78 | > furnished to do so, subject to the following conditions: 79 | > 80 | > The above copyright notice and this permission notice shall be included in 81 | > all copies or substantial portions of the Software. 82 | > 83 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 84 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 85 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 86 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 87 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 88 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 89 | > THE SOFTWARE. 90 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/summary@0.3.2/node_modules/summary/test.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var summary = require('./summary.js'); 4 | 5 | test('testing sort method', function (t) { 6 | t.deepEqual( 7 | summary([2, 3, 7, -2, 0, 1, 1], true).sort(), 8 | [2, 3, 7, -2, 0, 1, 1] 9 | ); 10 | 11 | t.deepEqual( 12 | summary([2, 3, 7, -2, 0, 1, 1], false).sort(), 13 | [-2, 0, 1, 1, 2, 3, 7] 14 | ); 15 | 16 | t.deepEqual( 17 | summary([2, 3, 7, -2, 0, 1, 1]).sort(), 18 | [-2, 0, 1, 1, 2, 3, 7] 19 | ); 20 | 21 | t.end(); 22 | }); 23 | 24 | test('testing size method', function (t) { 25 | t.equal( 26 | summary([1, 10]).size(), 27 | 2 28 | ); 29 | 30 | t.end(); 31 | }); 32 | 33 | test('testing sum method', function (t) { 34 | t.equal( 35 | summary([1, 10]).sum(), 36 | 11 37 | ); 38 | 39 | t.end(); 40 | }); 41 | 42 | test('testing mode method', function (t) { 43 | t.equal( 44 | summary([10, 11, 12, 11, 12, 7, 12]).mode(), 45 | 12 46 | ); 47 | 48 | t.equal( 49 | summary([10, 13, 12, 13, 12, 13, 12]).mode(), 50 | 13 51 | ); 52 | 53 | t.equal( 54 | summary([1, 2, 3]).mode(), 55 | 3 56 | ); 57 | 58 | t.end(); 59 | }); 60 | 61 | test('testing mean method', function (t) { 62 | t.equal( 63 | summary([2, 4]).mean(), 64 | 3 65 | ); 66 | 67 | t.end(); 68 | }); 69 | 70 | test('testing quartile method', function (t) { 71 | var data = summary([ 72 | 2, 27, 10, 29, 16, 8, 5, 19, 2, 2, 18,28, 73 | 7, 28, 28, 25, 19, 14, 18, 21, 25, 29, 7, 74 | 3, 21, 3, 24, 18, 12, 25 75 | ]); 76 | 77 | t.equal(data.quartile(0.00), 2.00); 78 | t.equal(data.quartile(0.13), 3.00); 79 | t.equal(data.quartile(0.26), 7.00); 80 | t.equal(data.quartile(0.39), 14.0); 81 | t.equal(data.quartile(0.52), 18.0); 82 | t.equal(data.quartile(0.65), 21.0); 83 | t.equal(data.quartile(0.78), 25.0); 84 | t.equal(data.quartile(0.91), 28.0); 85 | t.equal(data.quartile(1.00), 29.0); 86 | 87 | t.end(); 88 | }); 89 | 90 | test('testing median method', function (t) { 91 | var data = summary([ 92 | 2, 27, 10, 29, 16, 8, 5, 19, 2, 2, 18,28, 93 | 7, 28, 28, 25, 19, 14, 18, 21, 25, 29, 7, 94 | 3, 21, 3, 24, 18, 12, 25 95 | ]); 96 | 97 | t.equal(data.median(), 18); 98 | 99 | t.end(); 100 | }); 101 | 102 | test('testing variance method', function (t) { 103 | t.equal(summary([-2, -1, 0, 1, 2]).variance(), 2.5); 104 | 105 | t.end(); 106 | }); 107 | 108 | test('testing sd method', function (t) { 109 | t.equal(summary([-2, -1, 0, 1, 2]).sd(), Math.sqrt(2.5)); 110 | 111 | t.end(); 112 | }); 113 | 114 | test('testing max method', function (t) { 115 | t.equal(summary([6, 10, 2, 5]).max(), 10); 116 | 117 | t.end(); 118 | }); 119 | 120 | test('testing min method', function (t) { 121 | t.equal(summary([6, 10, 2, 5]).min(), 2); 122 | 123 | t.end(); 124 | }); 125 | 126 | test('typed array', function (t) { 127 | t.equal(summary(new Int8Array([2, 4])).mean(), 3); 128 | 129 | t.end(); 130 | }); 131 | -------------------------------------------------------------------------------- /load-testing/node_modules/.pnpm/ttest@2.1.1/node_modules/summary/test.js: -------------------------------------------------------------------------------- 1 | 2 | var test = require('tap').test; 3 | var summary = require('./summary.js'); 4 | 5 | test('testing sort method', function (t) { 6 | t.deepEqual( 7 | summary([2, 3, 7, -2, 0, 1, 1], true).sort(), 8 | [2, 3, 7, -2, 0, 1, 1] 9 | ); 10 | 11 | t.deepEqual( 12 | summary([2, 3, 7, -2, 0, 1, 1], false).sort(), 13 | [-2, 0, 1, 1, 2, 3, 7] 14 | ); 15 | 16 | t.deepEqual( 17 | summary([2, 3, 7, -2, 0, 1, 1]).sort(), 18 | [-2, 0, 1, 1, 2, 3, 7] 19 | ); 20 | 21 | t.end(); 22 | }); 23 | 24 | test('testing size method', function (t) { 25 | t.equal( 26 | summary([1, 10]).size(), 27 | 2 28 | ); 29 | 30 | t.end(); 31 | }); 32 | 33 | test('testing sum method', function (t) { 34 | t.equal( 35 | summary([1, 10]).sum(), 36 | 11 37 | ); 38 | 39 | t.end(); 40 | }); 41 | 42 | test('testing mode method', function (t) { 43 | t.equal( 44 | summary([10, 11, 12, 11, 12, 7, 12]).mode(), 45 | 12 46 | ); 47 | 48 | t.equal( 49 | summary([10, 13, 12, 13, 12, 13, 12]).mode(), 50 | 13 51 | ); 52 | 53 | t.equal( 54 | summary([1, 2, 3]).mode(), 55 | 3 56 | ); 57 | 58 | t.end(); 59 | }); 60 | 61 | test('testing mean method', function (t) { 62 | t.equal( 63 | summary([2, 4]).mean(), 64 | 3 65 | ); 66 | 67 | t.end(); 68 | }); 69 | 70 | test('testing quartile method', function (t) { 71 | var data = summary([ 72 | 2, 27, 10, 29, 16, 8, 5, 19, 2, 2, 18,28, 73 | 7, 28, 28, 25, 19, 14, 18, 21, 25, 29, 7, 74 | 3, 21, 3, 24, 18, 12, 25 75 | ]); 76 | 77 | t.equal(data.quartile(0.00), 2.00); 78 | t.equal(data.quartile(0.13), 3.00); 79 | t.equal(data.quartile(0.26), 7.00); 80 | t.equal(data.quartile(0.39), 14.0); 81 | t.equal(data.quartile(0.52), 18.0); 82 | t.equal(data.quartile(0.65), 21.0); 83 | t.equal(data.quartile(0.78), 25.0); 84 | t.equal(data.quartile(0.91), 28.0); 85 | t.equal(data.quartile(1.00), 29.0); 86 | 87 | t.end(); 88 | }); 89 | 90 | test('testing median method', function (t) { 91 | var data = summary([ 92 | 2, 27, 10, 29, 16, 8, 5, 19, 2, 2, 18,28, 93 | 7, 28, 28, 25, 19, 14, 18, 21, 25, 29, 7, 94 | 3, 21, 3, 24, 18, 12, 25 95 | ]); 96 | 97 | t.equal(data.median(), 18); 98 | 99 | t.end(); 100 | }); 101 | 102 | test('testing variance method', function (t) { 103 | t.equal(summary([-2, -1, 0, 1, 2]).variance(), 2.5); 104 | 105 | t.end(); 106 | }); 107 | 108 | test('testing sd method', function (t) { 109 | t.equal(summary([-2, -1, 0, 1, 2]).sd(), Math.sqrt(2.5)); 110 | 111 | t.end(); 112 | }); 113 | 114 | test('testing max method', function (t) { 115 | t.equal(summary([6, 10, 2, 5]).max(), 10); 116 | 117 | t.end(); 118 | }); 119 | 120 | test('testing min method', function (t) { 121 | t.equal(summary([6, 10, 2, 5]).min(), 2); 122 | 123 | t.end(); 124 | }); 125 | 126 | test('typed array', function (t) { 127 | t.equal(summary(new Int8Array([2, 4])).mean(), 3); 128 | 129 | t.end(); 130 | }); 131 | --------------------------------------------------------------------------------