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