(ops, title)
| 97 | }; |
| 98 | |
| 99 | function table(ops, title) { |
| 100 | // Layout: for each op, three sub-rows (one per column) sharing the op label. |
| 101 | const out = []; |
| 102 | out.push(`### ${title}`); |
| 103 | out.push(''); |
| 104 | const header = '| op | column | ' + PRECS.map((p) => `${p}d`).join(' | ') + ' |'; |
| 105 | out.push(header); |
| 106 | out.push('| --- | --- | ' + PRECS.map(() => '---:').join(' | ') + ' |'); |
| 107 | for (const op of ops) { |
| 108 | const opl = OPLABEL[op] ?? op; |
| 109 | COLUMNS.forEach(([name], ci) => { |
| 110 | const cells = PRECS.map((p) => fmt(results[name]?.[p]?.[op])); |
| 111 | const opCell = ci === 0 ? `\`${opl}\`` : ''; |
| 112 | out.push(`| ${opCell} | ${name} | ${cells.join(' | ')} |`); |
| 113 | }); |
| 114 | } |
| 115 | return out.join('\n'); |
| 116 | } |
| 117 | |
| 118 | console.log(table(PRIMITIVES, 'Primitive operations (ns/op, lower is faster)')); |
| 119 | console.log(''); |
no test coverage detected