source: trip-planner-front/node_modules/hdr-histogram-js/dist/bench/histogram-add.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 2.5 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 add", benny_1.default.add("Int32Histogram", () => {
10 const histogram = index_1.build();
11 const histogram2 = index_1.build();
12 for (let index = 0; index < 1024; index++) {
13 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
14 histogram2.recordValueWithCount(randomInteger(), randomInteger(100));
15 }
16 return () => {
17 histogram.add(histogram2);
18 };
19 }, options), benny_1.default.add("WASM 32B Histogram", () => {
20 const histogram = index_1.build({ useWebAssembly: true });
21 const histogram2 = index_1.build({ useWebAssembly: true });
22 for (let index = 0; index < 1024; index++) {
23 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
24 histogram2.recordValueWithCount(randomInteger(), randomInteger(100));
25 }
26 return () => {
27 histogram.add(histogram2);
28 };
29 }, options), benny_1.default.add("Packed Histogram", () => {
30 const histogram = index_1.build({ bitBucketSize: "packed" });
31 const histogram2 = index_1.build({ bitBucketSize: "packed" });
32 for (let index = 0; index < 1024; index++) {
33 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
34 histogram2.recordValueWithCount(randomInteger(), randomInteger(100));
35 }
36 return () => {
37 histogram.add(histogram2);
38 };
39 }, options), benny_1.default.add("WASM Packed Histogram", () => {
40 const histogram = index_1.build({
41 bitBucketSize: "packed",
42 useWebAssembly: true
43 });
44 const histogram2 = index_1.build({
45 bitBucketSize: "packed",
46 useWebAssembly: true
47 });
48 for (let index = 0; index < 1024; index++) {
49 histogram.recordValueWithCount(randomInteger(), randomInteger(100));
50 histogram2.recordValueWithCount(randomInteger(), randomInteger(100));
51 }
52 return () => {
53 histogram.add(histogram2);
54 };
55 }, options), benny_1.default.complete(), benny_1.default.save({ file: "add", format: "chart.html" }));
56});
57//# sourceMappingURL=histogram-add.js.map
Note: See TracBrowser for help on using the repository browser.