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

Optimize within pattern matching for Kanela modules [WIP] #141

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

melezov
Copy link

@melezov melezov commented Jun 11, 2022

ByteBuddy's StringMatcher uses String.matches which performs about 10x slower than caching a Pattern inside a custom PatternMatcher

Uglify the test / reference pattern examples to more closely match the required patterns

This change speeds up the boot of our production by 5-10% (times in ms)
image

Context: Testing the Kamon Bundle in our SaaS and probing how to reduce the now prolonged boot times.
The matches method of StringMatcher gets invoked about a million times during the boot (can provide logs) and seems to be a hotspot worth looking into.

@melezov
Copy link
Author

melezov commented Jun 11, 2022

At the end of the day, we'll probably manually add modules we're interested in, instead of using the bundle.

"app.kanela..*",
"java.net.*"
"app\\.kanela\\..*",
"java\\.net\\..*",
Copy link
Author

Choose a reason for hiding this comment

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

Technically, these could be .+, but it shouldn't really matter

@melezov melezov changed the title Optimize within matching Optimize within pattern matching for Kanela modules Jun 11, 2022
@melezov melezov changed the title Optimize within pattern matching for Kanela modules Optimize within pattern matching for Kanela modules [WIP] Jun 12, 2022
Marko Elezovic added 5 commits June 13, 2022 14:15
ByteBuddy's StringMatcher uses String.matches which performs about 10x slower
than caching a Pattern inside a custom PatternMatcher

Uglify the test / reference pattern examples to more closely match the required patterns

Flag incorrect InstrumentationLoader test
FlatSpec was removed in 3.2.x and replaced with AnyFlatSpec
Explicitly import Matchers and drop unused BeforeAndAfterAll usage
Bump scala library: 2.12.16
Bump config dependency: 1.4.2
Bump vavr dependency: 0.10.4
Bump lombok: 1.18.24

Bump plugins: scalatest 0.32 and shadow 7.1.2

Bump logback in tests: 1.2.11

Remove sunsetted jcenter repository
Prefix deprecated keys: (baseName|version|classifier) with `archive`
Drop unused project/build.properties SBT leftover
Use Class.getConstructors()[0].newInstance() for InstrumentationLoader

Misc tweaks - use https in a few places
@melezov
Copy link
Author

melezov commented Jun 13, 2022

Send a shout if you need this broken into multiple PRs. Tests should be good now.

@dpsoft
Copy link
Contributor

dpsoft commented Jun 13, 2022

@melezov thanks for this PR, I'll take a look ASAP.

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.

2 participants