-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmatrix.ts
More file actions
169 lines (148 loc) · 4.99 KB
/
matrix.ts
File metadata and controls
169 lines (148 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { getReleasedPduName } from './pdu-programs'
export const QUANTITY = ['apparent-size', 'block-size', 'block-count'] as const
export const MAX_DEPTH = ['1', '10'] as const
export const MIN_RATIO = ['0.01', '0'] as const
export const PROGRESS = [false, true] as const
export const NO_SORT = [false, true] as const
export interface SelfBenchmarkCategory {
readonly quantity: typeof QUANTITY[number]
readonly maxDepth: typeof MAX_DEPTH[number]
readonly minRatio: typeof MIN_RATIO[number]
readonly progress: typeof PROGRESS[number]
readonly noSort: typeof NO_SORT[number]
}
export const SELF_BENCHMARK_CATEGORIES: readonly SelfBenchmarkCategory[] = [{}]
.flatMap(category => QUANTITY.map(quantity => ({ ...category, quantity })))
.flatMap(category => MAX_DEPTH.map(maxDepth => ({ ...category, maxDepth })))
.flatMap(category => MIN_RATIO.map(minRatio => ({ ...category, minRatio })))
.flatMap(category => PROGRESS.map(progress => ({ ...category, progress })))
.flatMap(category => NO_SORT.map(noSort => ({ ...category, noSort })))
export function parseSelfBenchmarkCategory(category: SelfBenchmarkCategory) {
const { quantity, maxDepth, minRatio, progress, noSort } = category
const reportName =
`quantity=${quantity},maxDepth=${maxDepth},minRatio=${minRatio},progress=${progress},noSort=${noSort}` as const
const commandSuffix = [
`--quantity=${quantity}`,
`--max-depth=${maxDepth}`,
`--min-ratio=${minRatio}`,
...progress ? ['--progress'] as const : [] as const,
...noSort ? ['--no-sort'] as const : [] as const,
] as const
return { category, reportName, commandSuffix }
}
export const RELEASED_PDU_VERSIONS = [
'0.10.0',
'0.11.1',
'0.12.0',
] as const
export const ACCEPTABLE_PERFORMANCE_REGRESSION = 1.1 // 10%
export interface SelfBenchmarkUnit {
readonly pduVersion?: string
readonly pduExecName: string
}
export interface SelfBenchmarkUnitDev extends SelfBenchmarkUnit {
readonly pduVersion?: undefined
readonly pduExecName: 'pdu'
}
const DEV_UNIT: SelfBenchmarkUnitDev = { pduExecName: 'pdu' }
export interface SelfBenchmarkUnitReleased<Version extends string> extends SelfBenchmarkUnit {
readonly pduVersion: Version
readonly pduExecName: `pdu-${Version}`
}
export function createSelfBenchmarkUnitReleased<Version extends string>(
pduVersion: Version,
): SelfBenchmarkUnitReleased<Version> {
return { pduVersion, pduExecName: getReleasedPduName(pduVersion) }
}
const RELEASED_UNITS = RELEASED_PDU_VERSIONS.map(createSelfBenchmarkUnitReleased)
const UNITS = [DEV_UNIT, ...RELEASED_UNITS]
export const SELF_BENCHMARK_MATRIX = SELF_BENCHMARK_CATEGORIES
.map(category => ({ category, units: UNITS }))
export function getSelfBenchmarkHyperfineName<Version extends string>(
unit: SelfBenchmarkUnitDev | SelfBenchmarkUnitReleased<Version>,
) {
return unit.pduExecName
}
export const SELF_BENCHMARK_HYPERFINE_NAMES = UNITS.map(getSelfBenchmarkHyperfineName)
export interface CompetingBenchmarkCategory {
readonly id: string
readonly pduCliArgs: readonly string[]
readonly competitors: ReadonlyArray<readonly [string, ...string[]]>
}
export const COMPETING_BENCHMARK_MATRIX: readonly CompetingBenchmarkCategory[] = [
{
id: 'apparent-size',
pduCliArgs: ['--quantity=apparent-size'],
competitors: [
['dust', '--apparent-size'],
['dua', '--count-hard-links', '--apparent-size'],
['ncdu', '-o', '/dev/stdout', '-0'],
['gdu', '--show-apparent-size', '--non-interactive', '--no-progress'],
['du', '--count-links', '--apparent-size'],
],
},
{
id: 'block-size',
pduCliArgs: ['--quantity=block-size'],
competitors: [
['dust'],
['dua', '--count-hard-links'],
['ncdu', '-o', '/dev/stdout', '-0'],
['gdu', '--non-interactive', '--no-progress'],
['du', '--count-links'],
],
},
{
id: 'top-down',
pduCliArgs: ['--top-down'],
competitors: [
['dust', '--reverse'],
],
},
{
id: 'summary',
pduCliArgs: ['--max-depth=1'],
competitors: [
['dutree', '--summary'],
['dua', '--count-hard-links'],
['du', '--count-links', '--summarize'],
],
},
{
id: 'extreme-details',
pduCliArgs: ['--min-ratio=0'],
competitors: [
['dutree'],
['ncdu', '-o', '/dev/stdout', '-0'],
['du', '--count-links', '--apparent-size'],
],
},
{
id: 'no-sort',
pduCliArgs: ['--no-sort'],
competitors: [
['du', '--count-links'],
['dua', '--count-hard-links'],
['ncdu', '-o', '/dev/stdout', '-0'],
['gdu', '--non-interactive', '--no-progress'],
],
},
{
id: 'no-sort+summary',
pduCliArgs: ['--no-sort', '--max-depth=1'],
competitors: [
['dua', '--count-hard-links'],
['ncdu', '-o', '/dev/null', '-0'],
['gdu', '--non-interactive', '--no-progress'],
['du', '--count-links', '--summarize'],
],
},
{
id: 'progress',
pduCliArgs: ['--progress'],
competitors: [
['ncdu', '-o', '/dev/stdout', '-1'],
['gdu', '--non-interactive'],
],
},
]