Skip to content

Commit dc3fe6f

Browse files
committed
More precision with PreciseHdrHistogram
Three significant digits was probably okay, but this makes me a little more comfortable.
1 parent 6741912 commit dc3fe6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/queries/src/PreciseHdrHistogram.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { HDRHistogramParsedStats } from './executors/base/types'
55
/* A wrapper for Histogram that gets us more precision. See
66
* https://github.com/HdrHistogram/HdrHistogramJS/issues/35
77
*
8-
* Values inserted will be truncated to `logBase 10 scalingFactor` (i.e. 3)
8+
* Values inserted will be truncated to `logBase 10 scalingFactor` (i.e. 4)
99
* decimal places.
1010
*/
1111
export class PreciseHdrHistogram {
1212
// We'll need to multiply by scalingFactor anything we insert, and divide by scalingFactor
1313
// anything we output from here:
1414
private _histogramDirty: hdr.Histogram
15-
static scalingFactor: number = 1000
15+
static scalingFactor: number = 10000
1616

1717
constructor(
1818
request: hdr.BuildRequest
@@ -76,7 +76,8 @@ export const defaultRequest: hdr.BuildRequest = {
7676
autoResize: true,
7777
lowestDiscernibleValue: 1,
7878
highestTrackableValue: 2,
79-
numberOfSignificantValueDigits: 3,
79+
// NOTE: the default 'hdr-histogram-js' is 3, but we'll set it to the max of 5 here:
80+
numberOfSignificantValueDigits: 5,
8081
useWebAssembly: false,
8182
}
8283

0 commit comments

Comments
 (0)