source: trip-planner-front/node_modules/hdr-histogram-js/dist/bench/histogram-data-access.js@ 6c1585f

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

initial commit

  • Property mode set to 100644
File size: 2.2 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 = () => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
8 const options = { initCount: 1000 };
9 benny_1.default.suite("Histogram data access", benny_1.default.add("Int32Histogram", () => {
10 const histogram = index_1.build({ bitBucketSize: 32 });
11 return () => {
12 histogram.recordValue(randomInteger());
13 };
14 }, options), benny_1.default.add("PackedHistogram", () => {
15 const histogram = index_1.build({ bitBucketSize: "packed" });
16 return () => {
17 histogram.recordValue(randomInteger());
18 };
19 }, options), benny_1.default.add("Float64Histogram", () => {
20 const histogram = index_1.build({ bitBucketSize: 64 });
21 return () => {
22 histogram.recordValue(randomInteger());
23 };
24 }, options), benny_1.default.add("Int32Histogram eager allocation", () => {
25 const histogram = index_1.build({
26 bitBucketSize: 32,
27 highestTrackableValue: Number.MAX_SAFE_INTEGER
28 });
29 return () => {
30 histogram.recordValue(randomInteger());
31 };
32 }, options), benny_1.default.add("WASM Int32Histogram", () => {
33 const histogram = index_1.build({
34 useWebAssembly: true
35 });
36 return () => {
37 histogram.recordValue(randomInteger());
38 };
39 }, options), benny_1.default.add("WASM PackedHistogram", () => {
40 const histogram = index_1.build({
41 useWebAssembly: true
42 });
43 return () => {
44 histogram.recordValue(randomInteger());
45 };
46 }, options), benny_1.default.add("Float64Histogram eager allocation", () => {
47 const histogram = index_1.build({
48 bitBucketSize: 64,
49 highestTrackableValue: Number.MAX_SAFE_INTEGER
50 });
51 return () => {
52 histogram.recordValue(randomInteger());
53 };
54 }, options), benny_1.default.complete(), benny_1.default.save({ file: "data-access", format: "chart.html" }));
55});
56//# sourceMappingURL=histogram-data-access.js.map
Note: See TracBrowser for help on using the repository browser.