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

Function fmtUs

benchmarks/audit/audit.ts:245–253  ·  view source on GitHub ↗
(ms?: number)

Source from the content-addressed store, hash-verified

243// Median per-call time in **microseconds**. Two significant figures below 10µs
244// (so a fast Mathematica op reads `8.3`, not a floored `0`), whole µs above.
245const fmtUs = (ms?: number) => {
246 if (ms == null) return null;
247 const us = ms * 1000;
248 if (!(us > 0)) return '0';
249 if (us >= 10) return String(Math.round(us));
250 if (us >= 1) return us.toFixed(1);
251 const s = us.toPrecision(2);
252 return s.includes('.') ? s.replace(/0+$/, '').replace(/\.$/, '') : s;
253};
254
255// LaTeX for a case. Each case carries a hand-authored `latex` field (authored in
256// gen.py, alongside the Unicode `title`) so every formula typesets exactly as

Callers 1

cellFunction · 0.70

Calls 4

toFixedMethod · 0.80
toPrecisionMethod · 0.80
replaceMethod · 0.65
roundMethod · 0.45

Tested by

no test coverage detected