histogram-data-access-co.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const benny_1 = require("benny");
  4. const index_1 = require("../index");
  5. const wasm_1 = require("../wasm");
  6. wasm_1.initWebAssembly().then(() => {
  7. const randomInteger = () => Math.floor(Math.random() * 1000000);
  8. const randomSmallInteger = () => Math.floor(Math.random() * 1000);
  9. const options = { initCount: 1000 };
  10. benny_1.default.suite("Histogram data access with coordinated ommissions", benny_1.default.add("Int32Histogram", () => {
  11. const histogram = index_1.build({ bitBucketSize: 32 });
  12. return () => {
  13. histogram.recordValueWithExpectedInterval(randomInteger(), 100000);
  14. };
  15. }, options), benny_1.default.add("Int32Histogram no correction needed", () => {
  16. const histogram = index_1.build({ bitBucketSize: 32 });
  17. return () => {
  18. histogram.recordValueWithExpectedInterval(randomSmallInteger(), 100000);
  19. };
  20. }, options), benny_1.default.add("PackedHistogram", () => {
  21. const histogram = index_1.build({ bitBucketSize: "packed" });
  22. return () => {
  23. histogram.recordValueWithExpectedInterval(randomInteger(), 100000);
  24. };
  25. }, options), benny_1.default.add("PackedHistogram no correction needed", () => {
  26. const histogram = index_1.build({ bitBucketSize: "packed" });
  27. return () => {
  28. histogram.recordValueWithExpectedInterval(randomSmallInteger(), 100000);
  29. };
  30. }, options), benny_1.default.add("WASM Int32Histogram", () => {
  31. const histogram = index_1.build({
  32. useWebAssembly: true
  33. });
  34. return () => {
  35. histogram.recordValueWithExpectedInterval(randomInteger(), 100000);
  36. };
  37. }, options), benny_1.default.add("WASM Int32Histogram no correction needed", () => {
  38. const histogram = index_1.build({
  39. useWebAssembly: true
  40. });
  41. return () => {
  42. histogram.recordValueWithExpectedInterval(randomSmallInteger(), 100000);
  43. };
  44. }, options), benny_1.default.add("WASM PackedHistogram", () => {
  45. const histogram = index_1.build({
  46. useWebAssembly: true,
  47. bitBucketSize: "packed"
  48. });
  49. return () => {
  50. histogram.recordValueWithExpectedInterval(randomInteger(), 100000);
  51. };
  52. }, options), benny_1.default.add("WASM PackedHistogram no correction needed", () => {
  53. const histogram = index_1.build({
  54. useWebAssembly: true,
  55. bitBucketSize: "packed"
  56. });
  57. return () => {
  58. histogram.recordValueWithExpectedInterval(randomSmallInteger(), 100000);
  59. };
  60. }, options), benny_1.default.complete(), benny_1.default.save({ file: "data-access-co", format: "chart.html" }));
  61. });
  62. //# sourceMappingURL=histogram-data-access-co.js.map