{"ScriptPreparationCode":"function createSingleListQueue() {\r\n\treturn {\r\n\t\tqueue: [],\r\n\t\tenqueue(element) {\r\n\t\t\tthis.queue.push(element)\r\n\t\t},\r\n\t\tdequeue() {\r\n\t\t\treturn this.queue.shift()\r\n\t\t},\r\n\t\tisEmpty() {\r\n\t\t\treturn this.queue.length === 0\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvar __generator = (this \u0026\u0026 this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] \u0026 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \u0022throw\u0022: verb(1), \u0022return\u0022: verb(2) }, typeof Symbol === \u0022function\u0022 \u0026\u0026 (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\u0022Generator is already executing.\u0022);\r\n while (_) try {\r\n if (f = 1, y \u0026\u0026 (t = op[0] \u0026 2 ? y[\u0022return\u0022] : op[0] ? y[\u0022throw\u0022] || ((t = y[\u0022return\u0022]) \u0026\u0026 t.call(y), 0) : y.next) \u0026\u0026 !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] \u0026 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label\u002B\u002B; return { value: op[1], done: false };\r\n case 5: _.label\u002B\u002B; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length \u003E 0 \u0026\u0026 t[t.length - 1]) \u0026\u0026 (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 \u0026\u0026 (!t || (op[1] \u003E t[0] \u0026\u0026 op[1] \u003C t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 \u0026\u0026 _.label \u003C t[1]) { _.label = t[1]; t = op; break; }\r\n if (t \u0026\u0026 _.label \u003C t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] \u0026 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\nvar Queue = /** @class */ (function () {\r\n function Queue() {\r\n this._length = 0;\r\n this.st1 = [];\r\n this.st2 = [];\r\n }\r\n Object.defineProperty(Queue.prototype, \u0022length\u0022, {\r\n get: function () {\r\n return this._length;\r\n },\r\n set: function (len) {\r\n if (len === 0) {\r\n this.st1.length = 0;\r\n this.st2.length = 0;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Queue.prototype[Symbol.iterator] = function () {\r\n var st2, i, _i, _a, k;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n st2 = this.st2.slice();\r\n i = st2.length - 1;\r\n _b.label = 1;\r\n case 1:\r\n if (!(i \u003E= 0)) return [3 /*break*/, 4];\r\n return [4 /*yield*/, st2[i]];\r\n case 2:\r\n _b.sent();\r\n _b.label = 3;\r\n case 3:\r\n i--;\r\n return [3 /*break*/, 1];\r\n case 4:\r\n _i = 0, _a = this.st1;\r\n _b.label = 5;\r\n case 5:\r\n if (!(_i \u003C _a.length)) return [3 /*break*/, 8];\r\n k = _a[_i];\r\n return [4 /*yield*/, k];\r\n case 6:\r\n _b.sent();\r\n _b.label = 7;\r\n case 7:\r\n _i\u002B\u002B;\r\n return [3 /*break*/, 5];\r\n case 8: return [2 /*return*/];\r\n }\r\n });\r\n };\r\n Queue.prototype.entries = function () {\r\n var _a;\r\n var _this = this;\r\n var i = 1;\r\n var j = 0;\r\n var k = 0;\r\n return _a = {},\r\n _a[Symbol.iterator] = function () {\r\n return this;\r\n },\r\n _a.next = function () {\r\n var _ = [];\r\n for (var _i = 0; _i \u003C arguments.length; _i\u002B\u002B) {\r\n _[_i] = arguments[_i];\r\n }\r\n if (_this.st2.length \u003E= i) {\r\n return {\r\n value: [k\u002B\u002B, _this.st2[_this.st2.length - i\u002B\u002B]],\r\n done: false,\r\n };\r\n }\r\n if (_this.st2.length \u003C= i \u0026\u0026 !_this.st1.length) {\r\n return { value: undefined, done: true };\r\n }\r\n return _this.st1.length \u003E j ? { value: [k\u002B\u002B, _this.st1[j\u002B\u002B]], done: false } : { value: undefined, done: true };\r\n },\r\n _a;\r\n };\r\n Queue.prototype.peek = function () {\r\n return this.st2.length ? this.st2[this.st2.length - 1] : this.st1[0];\r\n };\r\n Queue.prototype.pop = function () {\r\n if (this._length \u003E 0) {\r\n this._length--;\r\n }\r\n if (this.st2.length) {\r\n return this.st2.pop();\r\n }\r\n while (this.st1.length) {\r\n this.st2.push(this.st1.pop());\r\n }\r\n return this.st2.pop();\r\n };\r\n Queue.prototype.push = function (v) {\r\n this.st1.push(v);\r\n this._length\u002B\u002B;\r\n };\r\n Queue.prototype.toArray = function () {\r\n var ret = [];\r\n for (var i = this.st2.length - 1; i \u003E= 0; i--) {\r\n ret.push(this.st2[i]);\r\n }\r\n return ret.concat(this.st1);\r\n };\r\n return Queue;\r\n}());\r\n\r\n\r\nvar singleQ = createSingleListQueue()\r\nvar doubleQ = new Queue()\r\nvar queueSize = 100000\r\n\r\nfor(let i = 0; i \u003C queueSize; i\u002B\u002B) {\r\n singleQ.enqueue(\u0027testString\u0027 \u002B i)\r\n doubleQ.push(\u0027testString\u0027 \u002B i)\r\n}","TestCases":[{"Name":"simple","Code":"for(let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n singleQ.dequeue()\r\n}\r\n\r\nfor(let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n singleQ.enqueue(\u0022t\u0022\u002Bi);\r\n singleQ.enqueue(\u0022t\u0022\u002Bi);\r\n singleQ.enqueue(\u0022t\u0022\u002Bi);\r\n singleQ.dequeue()\r\n singleQ.dequeue()\r\n singleQ.dequeue()\r\n}","IsDeferred":false},{"Name":"double array","Code":"for(let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n doubleQ.pop()\r\n}\r\nfor(let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n doubleQ.push(\u0022t\u0022\u002Bi);\r\n doubleQ.push(\u0022t\u0022\u002Bi);\r\n doubleQ.push(\u0022t\u0022\u002Bi);\r\n doubleQ.pop()\r\n doubleQ.pop()\r\n doubleQ.pop()\r\n}","IsDeferred":false}]}