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

Conversation

Projects
None yet
@apapirovski
Copy link
Member

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

@apapirovski apapirovski force-pushed the apapirovski:faster-freelist branch 2 times, most recently from 1ab7867 to 18428c9 Mar 30, 2019

Show resolved Hide resolved lib/_http_client.js Outdated
@apapirovski

This comment has been minimized.

Copy link
Member Author

commented Mar 31, 2019

Benchmark results

18:50:02                            confidence improvement accuracy (*)   (**)  (***)
18:50:02  misc/freelist.js n=100000        ***     13.46 %       ±1.82% ±2.40% ±3.08%
Show resolved Hide resolved benchmark/http/headers.js
@lpinca

lpinca approved these changes Mar 31, 2019

@targos

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@Trott

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

I opened #27083 to make the error message clearer.

apapirovski added some commits Mar 30, 2019

lib: faster FreeList
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.

@apapirovski apapirovski force-pushed the apapirovski:faster-freelist branch from 3491ab3 to 4409bf2 Apr 6, 2019

@nodejs-github-bot

This comment has been minimized.

@BeniCheni BeniCheni referenced this pull request Apr 8, 2019

Open

benchmark: add "byGroup" config option #26559

4 of 4 tasks complete
@jasnell

jasnell approved these changes Apr 8, 2019

@nodejs-github-bot

This comment has been minimized.

@danbev

This comment has been minimized.

Copy link
Member

commented Apr 11, 2019

Landed in 47f5cc1, and 29d0b43.

@danbev danbev closed this Apr 11, 2019

danbev added a commit that referenced this pull request Apr 11, 2019

lib: faster FreeList
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 <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

danbev added a commit that referenced this pull request Apr 11, 2019

benchmark: fix http headers benchmark
PR-URL: #27021
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.