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

timers: move priority_queue to internal/timers/ #26876

Closed
wants to merge 2 commits into from

Conversation

ZYSzys
Copy link
Member

@ZYSzys ZYSzys commented Mar 23, 2019

The priority_queue.js is only used in timers module, so maybe it's more reasonable to move it into internal/timers/ specifically ?

(I've used git mv command so I think it wouldn't hurt when git blame priority_queue.js)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Mar 23, 2019
@@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
}, { flags: ['--expose-internals'] });

function main({ n, type }) {
const PriorityQueue = require('internal/priority_queue');
const PriorityQueue = require('internal/timers/priority_queue');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should move this benchmark file to the timers directory now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do that (and I think it's a fine idea), be sure to run test/benchmark/test-benchmark-timers to make sure the move doesn't break that test file. (If it does break it, it should be easy to fix, but you may have to know something about how the benchmark tests work. Happy to help with that, although I'm guessing you'll figure it out if you aren't familiar with the benchmark tests already.)

Copy link
Member

@Trott Trott Mar 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^^^ You'll want to run that test locally because the benchmark tests don't run in node-test-pull-request. (But they do run in node-daily-master so if it breaks, we'll find out, but not until after the code lands!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep👍.

And I've run python tools/test.py -J --mode=release benchmark/test-benchmark-timers and this benchmark test passed, so I think it should be fine :)

Copy link
Member

@joyeecheung joyeecheung Mar 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way you can use https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/ to run this in the CI for this PR (use benchmark in CI_JS_SUITES)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thank you.

@lpinca
Copy link
Member

lpinca commented Mar 23, 2019

It is only used in timers now but it could be also used for something else in future no?

@joyeecheung
Copy link
Member

joyeecheung commented Mar 24, 2019

Benchmark CI (the testing one): https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/5617/

@ZYSzys
Copy link
Member Author

ZYSzys commented Mar 24, 2019

It is only used in timers now but it could be also used for something else in future no?

AFAIK, priority_queue.js was added in #20555 originally for improving timers performance specially.

It's a little hard for me to figure out other modules where priority_queue.js can be used in the future.

Maybe /cc @nodejs/timers

@Fishrock123
Copy link
Contributor

I do not see what purpose this PR is... Does this actually matter?

@ZYSzys
Copy link
Member Author

ZYSzys commented Mar 24, 2019

Maybe slightly improve the tidiness of our lib/internal/ files' structure, easier to know that priority_queue is used in timers module ?

Copy link
Contributor

@sam-github sam-github left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting timers code in internal/timers/ seems reasonable to me.

@BridgeAR
Copy link
Member

BridgeAR commented Apr 1, 2019

I personally would keep it where it is due to possibly reusing it elsewhere at some point.

Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s a generic implementation of a binary heap in JS. I see no reason to move it. Does this actually improve anything?

@ZYSzys
Copy link
Member Author

ZYSzys commented Apr 2, 2019

@apapirovski

Maybe slightly improve the tidiness of our lib/internal/ files' structure, easier to know that priority_queue is used in timers module ?

There was no any other affect,

and I'm also willng to close this since majority wants keep it is as original.

Still thanks all.

@ZYSzys ZYSzys closed this Apr 2, 2019
@ZYSzys ZYSzys deleted the internal-queue-mv branch May 13, 2019 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants