Hello,
how do you think is it possible to optimize code:
|
Maildir.prototype.listNew = function(callback) { |
Maildir.prototype.listNew = function(callback) {
this.fs.readdir(this.dirPaths[NEW], callback);
};
the point is for each pop operation it reads all content of the directory.
pop()->readdir()
pop()->readdir()
pop()->readdir()
In the sequence code
|
Queue.prototype.tryPop = function(messages, callback) { |
at
tryPop you use only 1 item from the array.
If the queue has size 1^e6 messages it .....
How about to optimize this place?
For example
- add
memoize
or
- consume result from
listNew() until it has elements?
Thank you.
Hello,
how do you think is it possible to optimize code:
file-queue/lib/maildir.js
Line 90 in 6f2bfa6
the point is for each
popoperation it reads all content of the directory.pop()->readdir()
pop()->readdir()
pop()->readdir()
In the sequence code
file-queue/queue.js
Line 76 in 6f2bfa6
at
tryPopyou use only 1 item from the array.If the queue has size 1^e6 messages it .....
How about to optimize this place?
For example
memoizeor
listNew()until it has elements?Thank you.