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

Increase print/visit performance #4312

Open
wants to merge 2 commits into
base: 16.x.x
Choose a base branch
from
Open

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Dec 16, 2024

This replaces our expensive method that changes the underlying V8 shape multiple times with a loop that preserves the identity as much as possible.

⏱   Print kitchen sink document
  1 tests completed.
  2 tests completed.

  HEAD x 9,290 ops/sec ±0.21% x 1.51 KB/op (24 runs sampled)
  BASE x 2,645 ops/sec ±0.18% x 2.18 KB/op (11 runs sampled)

Copy link

Hi @JoviDeCroock, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@JoviDeCroock

This comment has been minimized.

@JoviDeCroock JoviDeCroock marked this pull request as ready for review December 16, 2024 13:26
@JoviDeCroock JoviDeCroock requested a review from a team as a code owner December 16, 2024 13:26
Copy link

@github-actions run-benchmark

@JoviDeCroock

Benchmark output

[email protected] benchmark
node benchmark/benchmark.js "--revs" "HEAD" "BASE"

🍳 Preparing HEAD...
🍳 Preparing BASE...
⏱ Build Schema from AST
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m43.44�[0m ops/sec �[90m±�[0m�[32m1.83�[0m�[36m%�[0m�[90m x �[0m2.18 MB/op�[90m (8 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m44.01�[0m ops/sec �[90m±�[0m�[32m0.76�[0m�[36m%�[0m�[90m x �[0m2.18 MB/op�[90m (8 runs sampled)�[0m

⏱ Build Schema from Introspection
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m52.31�[0m ops/sec �[90m±�[0m�[32m0.91�[0m�[36m%�[0m�[90m x �[0m1.12 MB/op�[90m (11 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m52.47�[0m ops/sec �[90m±�[0m�[32m0.69�[0m�[36m%�[0m�[90m x �[0m1.12 MB/op�[90m (11 runs sampled)�[0m

⏱ Execute Introspection Query
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

�[32mHEAD�[0m�[90m x �[0m�[32m50.54�[0m ops/sec �[90m±�[0m�[32m1.20�[0m�[36m%�[0m�[90m x �[0m2.49 MB/op�[90m (8 runs sampled)�[0m
BASE�[90m x �[0m�[32m50.41�[0m ops/sec �[90m±�[0m�[32m1.14�[0m�[36m%�[0m�[90m x �[0m2.49 MB/op�[90m (8 runs sampled)�[0m

⏱ Parse introspection query
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

�[32mHEAD�[0m�[90m x �[0m�[32m13,609�[0m ops/sec �[90m±�[0m�[32m0.13�[0m�[36m%�[0m�[90m x �[0m2.62 KB/op�[90m (35 runs sampled)�[0m
BASE�[90m x �[0m�[32m13,576�[0m ops/sec �[90m±�[0m�[32m0.22�[0m�[36m%�[0m�[90m x �[0m2.62 KB/op�[90m (35 runs sampled)�[0m

⏱ Print kitchen sink document
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

�[32mHEAD�[0m�[90m x �[0m�[32m9,290�[0m ops/sec �[90m±�[0m�[32m0.21�[0m�[36m%�[0m�[90m x �[0m1.51 KB/op�[90m (24 runs sampled)�[0m
BASE�[90m x �[0m�[31m2,645�[0m ops/sec �[90m±�[0m�[32m0.18�[0m�[36m%�[0m�[90m x �[0m2.18 KB/op�[90m (11 runs sampled)�[0m

⏱ Many repeated fields
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m 99.2�[0m ops/sec �[90m±�[0m�[32m0.25�[0m�[36m%�[0m�[90m x �[0m525 KB/op�[90m (20 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m99.52�[0m ops/sec �[90m±�[0m�[32m0.18�[0m�[36m%�[0m�[90m x �[0m525 KB/op�[90m (20 runs sampled)�[0m

⏱ Validate Introspection Query
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m562�[0m ops/sec �[90m±�[0m�[32m0.22�[0m�[36m%�[0m�[90m x �[0m270 KB/op�[90m (14 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m563�[0m ops/sec �[90m±�[0m�[32m0.24�[0m�[36m%�[0m�[90m x �[0m270 KB/op�[90m (14 runs sampled)�[0m

⏱ Validate Invalid Query
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m505�[0m ops/sec �[90m±�[0m�[32m0.30�[0m�[36m%�[0m�[90m x �[0m326 KB/op�[90m (14 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m506�[0m ops/sec �[90m±�[0m�[32m0.18�[0m�[36m%�[0m�[90m x �[0m326 KB/op�[90m (14 runs sampled)�[0m

⏱ Validate SDL Document
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m67.44�[0m ops/sec �[90m±�[0m�[32m0.92�[0m�[36m%�[0m�[90m x �[0m203 KB/op�[90m (11 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m67.84�[0m ops/sec �[90m±�[0m�[32m0.85�[0m�[36m%�[0m�[90m x �[0m203 KB/op�[90m (11 runs sampled)�[0m

⏱ Visit all AST nodes
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m308�[0m ops/sec �[90m±�[0m�[33m3.86�[0m�[36m%�[0m�[90m x �[0m311 KB/op�[90m (19 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m313�[0m ops/sec �[90m±�[0m�[32m1.24�[0m�[36m%�[0m�[90m x �[0m311 KB/op�[90m (20 runs sampled)�[0m

⏱ Visit all AST nodes in parallel
�[36m1�[0m tests completed.
�[36m2�[0m tests completed.

HEAD�[90m x �[0m�[32m28.9�[0m ops/sec �[90m±�[0m�[32m0.50�[0m�[36m%�[0m�[90m x �[0m1.23 MB/op�[90m (7 runs sampled)�[0m
�[32mBASE�[0m�[90m x �[0m�[32m 29�[0m ops/sec �[90m±�[0m�[32m0.68�[0m�[36m%�[0m�[90m x �[0m1.23 MB/op�[90m (7 runs sampled)�[0m

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

Successfully merging this pull request may close these issues.

3 participants