Skip to content

Optimize listNew() #6

@Andrei-Stepanov

Description

@Andrei-Stepanov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions