b.js 717 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. // file for microbenchmarking
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. const buffer_writer_1 = require("./buffer-writer");
  5. const buffer_reader_1 = require("./buffer-reader");
  6. const LOOPS = 1000;
  7. let count = 0;
  8. let start = Date.now();
  9. const writer = new buffer_writer_1.Writer();
  10. const reader = new buffer_reader_1.BufferReader();
  11. const buffer = Buffer.from([33, 33, 33, 33, 33, 33, 33, 0]);
  12. const run = () => {
  13. if (count > LOOPS) {
  14. console.log(Date.now() - start);
  15. return;
  16. }
  17. count++;
  18. for (let i = 0; i < LOOPS; i++) {
  19. reader.setBuffer(0, buffer);
  20. reader.cstring();
  21. }
  22. setImmediate(run);
  23. };
  24. run();
  25. //# sourceMappingURL=b.js.map