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

chore(bench): add plain_parser and json_parser comparison bench #16526

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

xuefengze
Copy link
Contributor

@xuefengze xuefengze commented Apr 29, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

related #14815

image

flamegraph

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@xuefengze xuefengze requested a review from lmatz April 29, 2024 01:49
@lmatz
Copy link
Contributor

lmatz commented Apr 29, 2024

cc: @fuyufjh @tabVersion

plain_parser 294ms vs json_paser 271ms
~10%

@lmatz lmatz requested review from fuyufjh and tabVersion April 29, 2024 06:01
@lmatz
Copy link
Contributor

lmatz commented Apr 29, 2024

I think if we can flamegraph the plain_parser and json_parser separately,
then we will be able to locate the root cause

IIUC, plain_parser is doing strictly more things than json_parser, we just need to find the diff

Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

Thanks!

@lmatz
Copy link
Contributor

lmatz commented Apr 29, 2024

From @xuefengze

flamegraph_json_parser:
flamegraph_json_parser

flamegraph_plain_parser:
flamegraph_plain_parser
image (1)
image (2)

@lmatz
Copy link
Contributor

lmatz commented Apr 29, 2024

SCR-20240429-kr4

It seems this part of empty space took quite some time

SCR-20240429-kqw
because of branching?

I guess the fact that we parse row by row, generate accessor row by row, and insert row by row is a suboptimal way.

After all, we do chunk-based processing, why not multi-row/chunk-based parsing/inserting?

@lmatz
Copy link
Contributor

lmatz commented Apr 29, 2024

let's increase the input records, and run it again

suspect that the number of records is too low to reveal all the potential bottlenecks

@xuefengze
Copy link
Contributor Author

xuefengze commented Apr 29, 2024

json_parser:

Benchmarking plain parser and json parser comparison/json_parser: Collecting 100
plain parser and json parser comparison/json_parser
                        time:   [4.4026 s 4.4235 s 4.4456 s]
                        change: [+1460.9% +1472.7% +1485.3%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

flamegraph_json_parser2

plain_parser:

Benchmarking plain parser and json parser comparison/plain_parser: Collecting 100
plain parser and json parser comparison/plain_parser
                        time:   [4.8272 s 4.8427 s 4.8593 s]
                        change: [+1482.2% +1497.0% +1509.5%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe

flamegraph_plain_parser2

@lmatz lmatz added this pull request to the merge queue Apr 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 29, 2024
Copy link

gitguardian bot commented Apr 29, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
9425213 Triggered Generic Password 870891f e2e_test/source/cdc/cdc.validate.postgres.slt View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@xuefengze xuefengze enabled auto-merge April 29, 2024 09:14
@xuefengze xuefengze added this pull request to the merge queue Apr 29, 2024
Merged via the queue into main with commit fbc3a6c Apr 29, 2024
26 of 28 checks passed
@xuefengze xuefengze deleted the fz/add_json_parser_compare_bench branch April 29, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants