MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / table

Function table

benchmarks/big-decimal/run-ops.mjs:99–116  ·  view source on GitHub ↗
(ops, title)

Source from the content-addressed store, hash-verified

97};
98
99function 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
118console.log(table(PRIMITIVES, 'Primitive operations (ns/op, lower is faster)'));
119console.log('');

Callers 1

run-ops.mjsFile · 0.85

Calls 2

fmtFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected