1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | const benny_1 = require("benny");
|
---|
4 | const index_1 = require("../index");
|
---|
5 | const wasm_1 = require("../wasm");
|
---|
6 | const Histogram_1 = require("../Histogram");
|
---|
7 | wasm_1.initWebAssembly().then(() => {
|
---|
8 | const randomInteger = (max = Number.MAX_SAFE_INTEGER) => Math.floor(Math.random() * max);
|
---|
9 | const options = { initCount: 100 };
|
---|
10 | benny_1.default.suite("Histogram toJSON()", benny_1.default.add("JS 32B Histogram", () => {
|
---|
11 | const histogram = index_1.build({
|
---|
12 | bitBucketSize: 32
|
---|
13 | });
|
---|
14 | for (let index = 0; index < 1024; index++) {
|
---|
15 | histogram.recordValueWithCount(randomInteger(), randomInteger(100));
|
---|
16 | }
|
---|
17 | return () => {
|
---|
18 | Histogram_1.toSummary(histogram);
|
---|
19 | };
|
---|
20 | }, options), benny_1.default.add("WASM 32B Histogram", () => {
|
---|
21 | const histogram = index_1.build({
|
---|
22 | bitBucketSize: 32,
|
---|
23 | useWebAssembly: true
|
---|
24 | });
|
---|
25 | for (let index = 0; index < 1024; index++) {
|
---|
26 | histogram.recordValueWithCount(randomInteger(), randomInteger(100));
|
---|
27 | }
|
---|
28 | return () => {
|
---|
29 | Histogram_1.toSummary(histogram);
|
---|
30 | };
|
---|
31 | }, options), benny_1.default.add("Packed Histogram", () => {
|
---|
32 | const histogram = index_1.build({
|
---|
33 | bitBucketSize: "packed"
|
---|
34 | });
|
---|
35 | for (let index = 0; index < 1024; index++) {
|
---|
36 | histogram.recordValueWithCount(randomInteger(), randomInteger(100));
|
---|
37 | }
|
---|
38 | return () => {
|
---|
39 | Histogram_1.toSummary(histogram);
|
---|
40 | };
|
---|
41 | }, options), benny_1.default.add("WASM Packed Histogram", () => {
|
---|
42 | const histogram = index_1.build({
|
---|
43 | bitBucketSize: "packed",
|
---|
44 | useWebAssembly: true
|
---|
45 | });
|
---|
46 | for (let index = 0; index < 1024; index++) {
|
---|
47 | histogram.recordValueWithCount(randomInteger(), randomInteger(100));
|
---|
48 | }
|
---|
49 | return () => {
|
---|
50 | Histogram_1.toSummary(histogram);
|
---|
51 | };
|
---|
52 | }, options), benny_1.default.complete(), benny_1.default.save({ file: "json-percentile", format: "chart.html" }));
|
---|
53 | });
|
---|
54 | //# sourceMappingURL=histogram-json-percentile.js.map |
---|