-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Marko Elezovic
committed
Jun 11, 2022
1 parent
1c370d0
commit 0cd3a7b
Showing
5 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
kanela { | ||
modules { | ||
example-module { | ||
name = "Example Module" | ||
stoppable = false | ||
instrumentations = [ | ||
"app.kanela.instrumentation.MonitorInstrumentation", | ||
] | ||
within = [ "app.kanela.cases.+" ] | ||
} | ||
modules { | ||
example-module { | ||
name = "Example Module" | ||
stoppable = false | ||
instrumentations = [ | ||
"app.kanela.instrumentation.MonitorInstrumentation", | ||
] | ||
within = [ "app\\.kanela\\.cases\\..+" ] | ||
} | ||
debug-mode = false | ||
class-dumper.enabled = false | ||
} | ||
} | ||
debug-mode = false | ||
class-dumper.enabled = false | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kanela.agent.util; | ||
|
||
import net.bytebuddy.matcher.ElementMatcher; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class PatternMatcher extends ElementMatcher.Junction.AbstractBase<String> { | ||
private final Pattern regex; | ||
|
||
public PatternMatcher(final String regex) { | ||
this.regex = Pattern.compile(regex); | ||
} | ||
|
||
@Override | ||
public boolean matches(final String target) { | ||
return regex.matcher(target).matches(); | ||
} | ||
} |
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