MCPcopy Index your code
hub / github.com/josdejong/mathjs / formatTaskResult

Function formatTaskResult

test/benchmark/utils/formatTaskResult.js:11–20  ·  view source on GitHub ↗
(bench, task, digits = 2)

Source from the content-addressed store, hash-verified

9 * @return {string}
10 */
11export function formatTaskResult (bench, task, digits = 2) {
12 const nameWidth = Math.max(...bench.tasks.map(task => task.name.length)) + 1
13
14 const name = task.name
15 const { variance, mean } = task.result.latency
16
17 const meanStr = `${(mean * 1000).toFixed(digits)} \u00b5s`
18 const varianceStr = `±${((variance / mean) * 100).toFixed(2)}%`
19 return `${padRight(name, nameWidth)} ${padLeft(meanStr, durationWidth)} ${padLeft(varianceStr, varianceWidth)}`
20}
21
22function padRight (text, len, char = ' ') {
23 const add = Math.max(len - text.length, 0)

Callers 15

unit_parser.jsFile · 0.90
load.jsFile · 0.90
algebra.jsFile · 0.90
map.jsFile · 0.90
prime.jsFile · 0.90
derivative.jsFile · 0.90
subset.jsFile · 0.90
factorial.jsFile · 0.90
forEach.jsFile · 0.90
accessor.jsFile · 0.90

Calls 4

padRightFunction · 0.85
padLeftFunction · 0.85
maxMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…