Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize listNew() #6

Open
Andrei-Stepanov opened this issue Feb 18, 2021 · 0 comments
Open

Optimize listNew() #6

Andrei-Stepanov opened this issue Feb 18, 2021 · 0 comments

Comments

@Andrei-Stepanov
Copy link

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.
Andrei-Stepanov added a commit to fedora-ci/kaijs that referenced this issue Jun 28, 2022
Signed-off-by: Andrei Stepanov <astepano@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant