-
Notifications
You must be signed in to change notification settings - Fork 75
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
CBL-5522: Port - N1QL Parser has exponential slowdown for redundant parentheses #1984
Conversation
Context of why the change fixes something? |
@borrrden For expressions with many redundant layers of parentheses (i.e. This change strips all but 1 pair of parentheses from each expression, at the very top-level. So all unnecessary recursion due to parentheses is avoided. |
Have you compared with this test, "N1QL Performance"/"N1QL benchmark"? |
@jianminzhao No? I don't believe that's relevant? |
@jianminzhao See previous PR #1983 |
Code Coverage Results:
|
@jianminzhao I ran the test out of curiosity. This issue doesn't really show with the small amount (4) nested parentheses in the test.
And in this branch:
|
With 4 nested, in master:
In this branch:
|
The purpose of that test is to catch regression in performance. PEG has quirky thing that some rules may affect performance gravely. The degradation can show up in as simple as several level of parenthesis. |
@jianminzhao Exactly yes. Because it removes all the parentheses at the top level, without recursion, the performance impact of the number of parentheses is now negligible. |
That is not the purpose of that test. The purpose of the test is to discover performance degradation of other grammar rules. Now, this test becomes meaningless. |
The problem is solved though, so what is the issue? If you want to write more tests to try other potentially performance impacting queries that's fine. |
The purpose of this commit is to improve the performance by removing unnecessary parenthesis. The purpose of this particular test is to magnify the performance degradation of additional grammar rule. In short, this test can be removed with this commit. |
CBL-5629: Update zlib to 1.3.1 (#2032) CBL-5627: Update min MacOS version to 12.0 (#2033) CBL-5539: Add an API to check if a vector index is trained or not (#2035) CBL-5628: Update mbedtls to 2.28.8 (#2027) 374d485 Support latest vectorsearch (dev branch) and hybrid queries (#1980) 5c3c854 Lazy vector index updating (#1949) CBL-5522: Port - N1QL Parser has exponential slowdown for redundant parentheses (#1984) ab19634 Part of CBL 5579 in order to facilitate VS on .NET Android (#1993) CBL-5507: Fix index-past-end in CookieStore (#1982) CBL-5591: Binary Decoder to account for the new Logging object path (#1995) 294c3f8 Define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES (#1987) CBL-5438: DateTime standard format parser (#1977) CBL-5498: Util changes for ConnectedClient (#1978) CBL-5450: Remote rev KeepBody flag could be cleared accidentally f8a8de2 Remove UWP builds from build scripts (#1954) CBL-5425: Binary Encoder to encode the (Logging) object path (#1986) CBL-4661: Fix ROUND_EVEN. (#1981)
CBL-5629: Update zlib to 1.3.1 (#2032) CBL-5627: Update min MacOS version to 12.0 (#2033) CBL-5539: Add an API to check if a vector index is trained or not (#2035) CBL-5628: Update mbedtls to 2.28.8 (#2027) 374d485 Support latest vectorsearch (dev branch) and hybrid queries (#1980) 5c3c854 Lazy vector index updating (#1949) CBL-5522: Port - N1QL Parser has exponential slowdown for redundant parentheses (#1984) ab19634 Part of CBL 5579 in order to facilitate VS on .NET Android (#1993) CBL-5507: Fix index-past-end in CookieStore (#1982) CBL-5591: Binary Decoder to account for the new Logging object path (#1995) 294c3f8 Define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES (#1987) CBL-5438: DateTime standard format parser (#1977) CBL-5498: Util changes for ConnectedClient (#1978) CBL-5450: Remote rev KeepBody flag could be cleared accidentally f8a8de2 Remove UWP builds from build scripts (#1954) CBL-5425: Binary Encoder to encode the (Logging) object path (#1986) CBL-4661: Fix ROUND_EVEN. (#1981)
No description provided.