chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -30,6 +30,15 @@ interface BenchmarkOptions extends UtilityOptions {
|
|||
iterations?: string
|
||||
}
|
||||
|
||||
/** Per-operation timing summary produced by `brainy benchmark`. */
|
||||
interface BenchmarkOperationStats {
|
||||
avg: string
|
||||
min: number
|
||||
max: number
|
||||
median: number
|
||||
ops: string
|
||||
}
|
||||
|
||||
let brainyInstance: Brainy | null = null
|
||||
|
||||
const getBrainy = (): Brainy => {
|
||||
|
|
@ -188,7 +197,10 @@ export const utilityCommands = {
|
|||
|
||||
console.log(chalk.cyan(`\n🚀 Running Benchmarks (${iterations} iterations)\n`))
|
||||
|
||||
const results: any = {
|
||||
const results: {
|
||||
operations: Record<string, BenchmarkOperationStats>
|
||||
summary: { totalOperations?: number; averageOpsPerSec?: string }
|
||||
} = {
|
||||
operations: {},
|
||||
summary: {}
|
||||
}
|
||||
|
|
@ -253,7 +265,7 @@ export const utilityCommands = {
|
|||
}
|
||||
|
||||
// Calculate summary
|
||||
const totalOps: number = (Object.values(results.operations) as any[]).reduce((sum: number, op: any) =>
|
||||
const totalOps: number = Object.values(results.operations).reduce((sum: number, op) =>
|
||||
sum + parseFloat(op.ops), 0)
|
||||
|
||||
results.summary = {
|
||||
|
|
@ -277,7 +289,7 @@ export const utilityCommands = {
|
|||
style: { head: [], border: [] }
|
||||
})
|
||||
|
||||
Object.entries(results.operations).forEach(([op, stats]: [string, any]) => {
|
||||
Object.entries(results.operations).forEach(([op, stats]) => {
|
||||
table.push([
|
||||
op,
|
||||
stats.avg,
|
||||
|
|
|
|||
Reference in a new issue