-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Performance improvements for the event query API #7319
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
creachadair
force-pushed
the
mjf/weary-query
branch
from
November 25, 2021 04:35
0a03363
to
906ad70
Compare
creachadair
requested review from
cmwaters,
ebuchman,
tychoish and
williambanfield
as code owners
November 25, 2021 04:47
closes #6439. Amazing work!! |
creachadair
force-pushed
the
mjf/weary-query
branch
2 times, most recently
from
November 28, 2021 01:50
96eb55d
to
1d9e519
Compare
cmwaters
approved these changes
Nov 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM although I haven't really done a deep dive. I just have a few questions?
This doesn't change any query parsing behavior right?
tychoish
reviewed
Nov 29, 2021
So we can still test and benchmark, but leaves the main package clear for the new implementation. Also: emove unused test case fields All the tests in this group are expected to compile. Remove the compile-error check field, which was always false. All the tests in this group do not want a match error. Remove the match-error check field.
These are the same test cases that the original implementation uses. Remove the one that doesn't pass for silly reasons, and document why.
Compiled -> Query update receiver names fix usage in test
Results: BenchmarkParsePEG-12 24410 48992 ns/op 526828 B/op 27 alloc/op BenchmarkParseCustom-12 566208 2150 ns/op 4616 B/op 17 alloc/op BenchmarkMatchPEG-12 396376 3082 ns/op 1097 B/op 22 alloc/op BenchmarkMatchCustom-12 4125183 287.4 ns/op 64 B/op 3 alloc/op
This ensures the examples are likely to be somewhat correct.
This replaces the old "Empty" query, whose name described the implementation rather than the effect.
Also update generated mocks. Directories: - internal/eventbus - internal/inspect - internal/state/indexer - libs/pubsub - types
Some of these are incredibly useless.
creachadair
force-pushed
the
mjf/weary-query
branch
from
November 29, 2021 16:34
f597fb0
to
9299438
Compare
tychoish
approved these changes
Nov 29, 2021
creachadair
force-pushed
the
mjf/weary-query
branch
from
November 29, 2021 19:57
52f142e
to
6368cd2
Compare
This was referenced Nov 29, 2021
creachadair
pushed a commit
that referenced
this pull request
Nov 29, 2021
creachadair
pushed a commit
that referenced
this pull request
Nov 30, 2021
creachadair
pushed a commit
that referenced
this pull request
Nov 30, 2021
This was referenced Jan 31, 2022
lklimek
referenced
this pull request
in dashpay/tenderdash
Mar 25, 2022
A manual backport of #7319 and #7336. (cherry picked from commit 1c1ce83)
mmsqe
pushed a commit
to mmsqe/tendermint
that referenced
this pull request
Aug 30, 2022
Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ``` Components: * Add a basic parsing benchmark. * Move the original query implementation to a subdirectory. * Add lexical scanner for Query expressions. * Add a parser for Query expressions. * Implement query compiler. * Add test cases based on OpenAPI examples. * Add MustCompile to replace the original MustParse, and update usage.
mmsqe
pushed a commit
to mmsqe/tendermint
that referenced
this pull request
Aug 30, 2022
Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ``` Components: * Add a basic parsing benchmark. * Move the original query implementation to a subdirectory. * Add lexical scanner for Query expressions. * Add a parser for Query expressions. * Implement query compiler. * Add test cases based on OpenAPI examples. * Add MustCompile to replace the original MustParse, and update usage.
mmsqe
pushed a commit
to mmsqe/tendermint
that referenced
this pull request
Aug 30, 2022
Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ``` Components: * Add a basic parsing benchmark. * Move the original query implementation to a subdirectory. * Add lexical scanner for Query expressions. * Add a parser for Query expressions. * Implement query compiler. * Add test cases based on OpenAPI examples. * Add MustCompile to replace the original MustParse, and update usage.
mmsqe
pushed a commit
to mmsqe/tendermint
that referenced
this pull request
Aug 30, 2022
Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ``` Components: * Add a basic parsing benchmark. * Move the original query implementation to a subdirectory. * Add lexical scanner for Query expressions. * Add a parser for Query expressions. * Implement query compiler. * Add test cases based on OpenAPI examples. * Add MustCompile to replace the original MustParse, and update usage.
3 tasks
cmwaters
pushed a commit
that referenced
this pull request
Sep 13, 2022
…9334) * Performance improvements for the event query API (#7319) Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates #6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ```
mmsqe
pushed a commit
to mmsqe/tendermint
that referenced
this pull request
Sep 22, 2022
mmsqe
added a commit
to mmsqe/tendermint
that referenced
this pull request
Dec 9, 2022
…t#7319) (tendermint#9334) * Performance improvements for the event query API (tendermint#7319) Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ```
mmsqe
added a commit
to mmsqe/tendermint
that referenced
this pull request
Dec 9, 2022
…t#7319) (tendermint#9334) * Performance improvements for the event query API (tendermint#7319) Rework the implementation of event query parsing and execution to improve performance and reduce memory usage. Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained. Updates tendermint#6439. Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom): ``` TEST TIME/OP BYTES/OP ALLOCS/OP SPEEDUP MEM SAVING BenchmarkParsePEG-12 51716 ns 526832 27 BenchmarkParseCustom-12 2167 ns 4616 17 23.8x 99.1% BenchmarkMatchPEG-12 3086 ns 1097 22 BenchmarkMatchCustom-12 294.2 ns 64 3 10.5x 94.1% ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rework the implementation of event query parsing and execution to improve performance and reduce memory usage.
Previous memory and CPU profiles of the pubsub service showed query processing as a significant hotspot. While we don't have evidence that this is visibly hurting users, fixing it is fairly easy and self-contained.
Updates #6439.
Structure
oldquery
subdirectory. This can probably be deleted before merging.syntax
subpackage providing a lexical scanner and parser to replace the generated PEG parser.Benchmarks
Typical benchmark results comparing the original implementation (PEG) with the reworked implementation (Custom):