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

lib: make FreeList faster #27021

Closed
wants to merge 2 commits into from
Closed

Conversation

apapirovski
Copy link
Member

@apapirovski apapirovski commented Mar 30, 2019

1st commit makes FreeList alloc faster by using Reflect.apply and removing is_reused_symbol.

2nd commit fixes a benchmark that I needed to run to confirm the results.

CI: https://ci.nodejs.org/job/node-test-pull-request/22260/
Benchmarks: https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/312/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the http Issues or PRs related to the http subsystem. label Mar 30, 2019
@apapirovski apapirovski force-pushed the faster-freelist branch 2 times, most recently from 1ab7867 to 18428c9 Compare March 30, 2019 22:37
lib/_http_client.js Outdated Show resolved Hide resolved
@apapirovski
Copy link
Member Author

Benchmark results

18:50:02                            confidence improvement accuracy (*)   (**)  (***)
18:50:02  misc/freelist.js n=100000        ***     13.46 %       ±1.82% ±2.40% ±3.08%

benchmark/http/headers.js Show resolved Hide resolved
@targos
Copy link
Member

targos commented Mar 31, 2019

Suggestion for the commit title: "lib: make FreeList faster"

@apapirovski apapirovski changed the title lib: faster FreeList lib: make FreeList faster Mar 31, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Mar 31, 2019

Because these tests are often forgotten until the nightly run: Please make sure test/benchmark/test-benchmark-http.js and test/benchmark/test-benchmark-misc.js still pass with these changes.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 1, 2019
@BridgeAR
Copy link
Member

BridgeAR commented Apr 1, 2019

Please make sure test/benchmark/test-benchmark-http.js and test/benchmark/test-benchmark-misc.js still pass with these changes.

The test will continue to pass.

@danbev
Copy link
Contributor

danbev commented Apr 4, 2019

I'm getting the following lint error locally for this:

$ make lint-js
Running JS linter...

/Users/danielbevenius/work/nodejs/node/lib/internal/freelist.js
  18:7  error  Unexpected use of 'Reflect'  no-restricted-globals

✖ 1 problem (1 error, 0 warnings)

Not sure why this is not picked up by CI. I'm happy to add an ignore to this line but wanted to bring it up here first.

@BridgeAR
Copy link
Member

BridgeAR commented Apr 4, 2019

@danbev the reason is that the rule just landed recently and the CI ran before the rule landed. Instead of adding an exception it would be ideal to use the primordials (const { Reflect } = primordials;).

@targos
Copy link
Member

targos commented Apr 4, 2019

I opened #27083 to make the error message clearer.

Make FreeList faster by using Reflect.apply and not using
is_reused_symbol, but rather just checking whether any
items are present in the list prior to calling alloc.
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@danbev
Copy link
Contributor

danbev commented Apr 11, 2019

Landed in 47f5cc1, and 29d0b43.

@danbev danbev closed this Apr 11, 2019
danbev pushed a commit that referenced this pull request Apr 11, 2019
Make FreeList faster by using Reflect.apply and not using
is_reused_symbol, but rather just checking whether any
items are present in the list prior to calling alloc.

PR-URL: #27021
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
danbev pushed a commit that referenced this pull request Apr 11, 2019
PR-URL: #27021
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.