source: trip-planner-front/node_modules/hdr-histogram-js/dist/bench/histogram-json-percentile.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const benny_1 = require("benny");
4const index_1 = require("../index");
5const wasm_1 = require("../wasm");
6const Histogram_1 = require("../Histogram");
7wasm_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
Note: See TracBrowser for help on using the repository browser.