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

Speedup lang-painless tests #605

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

rmuir
Copy link
Contributor

@rmuir rmuir commented Apr 23, 2021

This PR follows up on #580 to fix performance issues with lang-painless tests.
There are ~1000 painless test methods and each one was inefficiently creating a new script engine (re-parsing whitelists and such).
On my machine the change gives ~ 2x speedup for the lang-painless tests.

Now the tests that need to tweak script engine settings create a class level fixture (BeforeClass/AfterClass) that is used across all the test methods in that suite. It is also a conceptual simplification: all the test methods within a file use the same settings.

RegexLimitTests was split into two suites (limit=1 and limit=2) rather than dynamically applying different settings.

C2 compiler is no longer needed for tests to be fast, instead tests runfaster with C1 only as expected, like the rest of the unit tests.

Signed-off-by: Robert Muir rmuir@apache.org

Painless tests would previously create script engine for every single test method.
Now the tests that need to tweak script engine settings create a class
level fixture (BeforeClass/AfterClass) that is used across all the test
methods in that suite.

RegexLimitTests was split into two suites (limit=1 and limit=2) rather
than dynamically applying different settings.

C2 compiler is no longer needed for tests to be fast, instead tests run
faster with C1 only as expected, like the rest of the unit tests.

Signed-off-by: Robert Muir <rmuir@apache.org>
@odfe-release-bot
Copy link

✅   Gradle Wrapper Validation success a0b5b27

@odfe-release-bot
Copy link

✅   DCO Check Passed a0b5b27

@odfe-release-bot
Copy link

✅   Gradle Precommit success a0b5b27

@nknize
Copy link
Collaborator

nknize commented Apr 23, 2021

start gradle check

@nknize
Copy link
Collaborator

nknize commented Apr 23, 2021

Thanks @rmuir!!! These PRs are super important! Every performance improvement we can get with these tests are compounding productivity!

@odfe-release-bot
Copy link

✅   Gradle Check success a0b5b27
Log 134

Reports 134

@@ -26,7 +26,7 @@
*/

/**
* Lexer, parser, and tree {@link Walker} responsible for turning the code
* Lexer, parser, and tree walker responsible for turning the code
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fyi: these unrelated javadocs changes are just so that the module would compile in eclipse for me (it is picky by default about such stuff). I tried to avoid touching src/java in this PR, and I know eclipse is unsupported, but I use it for refactoring such as "rename method".

@adnapibar adnapibar self-requested a review April 23, 2021 17:06
@adnapibar adnapibar added community Issues raised by community members and contributors Build Libraries & Interfaces labels Apr 23, 2021
Copy link
Contributor

@adnapibar adnapibar left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @rmuir

@nknize
Copy link
Collaborator

nknize commented Apr 27, 2021

This has sat longer than it should've because of the release tagging. Merging and closing.

@nknize nknize merged commit 13aa169 into opensearch-project:main Apr 27, 2021
@nknize nknize added pending backport Identifies an issue or PR that still needs to be backported v1.0.0 Version 1.0.0 v2.0.0 Version 2.0.0 labels Apr 27, 2021
nknize pushed a commit to nknize/OpenSearch that referenced this pull request Apr 27, 2021
Painless tests would previously create script engine for every single test method.
Now the tests that need to tweak script engine settings create a class
level fixture (BeforeClass/AfterClass) that is used across all the test
methods in that suite.

RegexLimitTests was split into two suites (limit=1 and limit=2) rather
than dynamically applying different settings.

C2 compiler is no longer needed for tests to be fast, instead tests run
faster with C1 only as expected, like the rest of the unit tests.

Signed-off-by: Robert Muir <rmuir@apache.org>
nknize added a commit that referenced this pull request Apr 28, 2021
Painless tests would previously create script engine for every single test method.
Now the tests that need to tweak script engine settings create a class
level fixture (BeforeClass/AfterClass) that is used across all the test
methods in that suite.

RegexLimitTests was split into two suites (limit=1 and limit=2) rather
than dynamically applying different settings.

C2 compiler is no longer needed for tests to be fast, instead tests run
faster with C1 only as expected, like the rest of the unit tests.

Signed-off-by: Robert Muir <rmuir@apache.org>
@nknize nknize removed the pending backport Identifies an issue or PR that still needs to be backported label Apr 28, 2021
ritty27 pushed a commit to ritty27/OpenSearch that referenced this pull request May 12, 2024
* Added "smartcn" analyzer.

Signed-off-by: pieper <mike.pieper@ser.de>

* Adapted changelog.

Signed-off-by: pieper <mike.pieper@ser.de>

* Fixed license headers.

Signed-off-by: pieper <mike.pieper@ser.de>

* Fixed release number.

Signed-off-by: pieper <mike.pieper@ser.de>

---------

Signed-off-by: pieper <mike.pieper@ser.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Libraries & Interfaces community Issues raised by community members and contributors v1.0.0 Version 1.0.0 v2.0.0 Version 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants