Check runtime typeguard

admin

javascript

check runtime typeguard performance:
другие самплы
main
tests.js
utils.js
//@ts-check

const { benchmarkDecorator } = require('./utils');
const { test, testGuard } = require('./tests');


const arr = new Array(10 ** 6).fill(1);
// arr.push('-')


/**
 * @type {Parameters<benchmarkDecorator>[1]}
 */
const options = {
    warmingUp: 0,
    testCount: 10,
    args: [arr],
    verbose: false
}

console.log(options);

const testResults = benchmarkDecorator(test, options);
console.log(testResults);

const testGuardResults = benchmarkDecorator(testGuard, options);
console.log(testGuardResults);
Новый листинг
скачать через терминал: wget https://coding-style.ru/code_reviews/download/391 && mkdir "check runtime typeguard" && unzip 391 -d ./"check runtime typeguard" && rm 391 && cd "check runtime typeguard"" && git init
(ваш голос учтен)

Прикрепить файл