petkaantonov / deque Goto Github PK
View Code? Open in Web Editor NEWExtremely fast double-ended queue implementation
License: MIT License
Extremely fast double-ended queue implementation
License: MIT License
Hi, thank you for your work. It's great.
I'd like to use this module for my project. But, I need to copy the deque instance after creation. I guess the only way is making another deque instance after toArray
from the previous one. I'm afraid of losing a performance gain in this way.
Any other better way to copy it?
Hi, it would be nice if we could specify a maximum length for the queue. If you push onto a full queue, it pops from the end, never increasing in size above the specified maximum.
Hi Sir,
Please help me, how can I resolve this problem?
TypeError: Cannot assign to read only property 'isEmpty' of #
at Object. (C:\Users\Acer Valued Customer\Documents\Serboy\Coding\Analytics\Analytics.Web\node_modules\double-ended-queue\js\deque.js:185:25)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\Acer Valued Customer\Documents\Serboy\Coding\Analytics\Analytics.Web\node_modules\redis\index.js:8:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\Acer Valued Customer\Documents\Serboy\Coding\Analytics\Analytics.Web\node_modules\connect-redis\lib\connect-redis.js:8:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\Acer Valued Customer\Documents\Serboy\Coding\Analytics\Analytics.Web\node_modules\connect-redis\index.js:1:80)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
Thanks,
i am using this in my project , but problem is that i am not getting queue item id , because i want remove item from queue , when user cancel the request . is it possible?
Adding a .next will allow a deque to be iterated over by for...of loops and the like.
Hi @petkaantonov -
I'd like to be able to iterate over the elements in a queue without converting it to an array. To do this I need to expose Deque's length attribute (i.e. change it from _length to length). I'd be happy to submit a PR for this if you think it's a reasonable change. Please let me know.
Ryan
I'm getting significantly faster performance using a native array this.arr = [];
and replacing all instances of this[]
with this.arr[]
. Running the two_million benchmark, I'm getting ~23 milllion ops/s with this[]
vs 25-26 million ops/s using this.arr[]
Thoughts?
Darwin 13.4.0 x64
Node.JS 4.1.2
V8 4.5.103.35
Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz ร 8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.