source: trip-planner-front/node_modules/hdr-histogram-js/dist/bench/histogram-percentile.js@ 6a3a178

Last change on this file since 6a3a178 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");
6wasm_1.initWebAssembly().then(() => {
7 const randomInteger = (max = Number.MAX_SAFE_INTEGER) => Math.floor(Math.random() * max);
8 const options = { initCount: 1000 };
9 benny_1.default.suite("Histogram get value at percentile", benny_1.default.add("Int32Histogram", () => {
10 const histogram = index_1.build({
11 bitBucketSize: 32
12 });
13 for (let index = 0; index < 1024; index++) {
14 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
15 }
16 return () => {
17 histogram.getValueAtPercentile(99);
18 };
19 }, options), benny_1.default.add("WASM 32B Histogram", () => {
20 const histogram = index_1.build({
21 bitBucketSize: 32,
22 useWebAssembly: true
23 });
24 for (let index = 0; index < 1024; index++) {
25 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
26 }
27 return () => {
28 histogram.getValueAtPercentile(99);
29 };
30 }, options), benny_1.default.add("Packed Histogram", () => {
31 const histogram = index_1.build({
32 bitBucketSize: "packed"
33 });
34 for (let index = 0; index < 1024; index++) {
35 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
36 }
37 return () => {
38 histogram.getValueAtPercentile(99);
39 };
40 }, options), benny_1.default.add("WASM Packed Histogram", () => {
41 const histogram = index_1.build({
42 bitBucketSize: "packed",
43 useWebAssembly: true
44 });
45 for (let index = 0; index < 1024; index++) {
46 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
47 }
48 return () => {
49 histogram.getValueAtPercentile(99);
50 };
51 }, options), benny_1.default.complete(), benny_1.default.save({ file: "percentile", format: "chart.html" }));
52});
53//# sourceMappingURL=histogram-percentile.js.map
Note: See TracBrowser for help on using the repository browser.