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

Support for prefix/equals-ignore-case and suffix/equals-ignore-case #121

Merged
merged 5 commits into from
Oct 24, 2023

Conversation

rogeriosy
Copy link
Contributor

@rogeriosy rogeriosy commented Oct 23, 2023

Issue #, if available: #108

Description of changes:

  • Adding functionality for prefix/equals-ignore-case and suffix/equals-ignore-case with the respective unit tests, benchmarks, and README updates.
  • Explicitly running the benchmarks class after mvn verify is executed. By default, the maven-surefire-plugin only runs tests with the "Test" which ends up ignoring the Benchmarks test class.

Benchmark / Performance (for source code changes):

From my mac laptop (2.6 GHz 6-Core Intel Core i7 / 16 GB 2667 MHz DDR4):

Reading citylots2
Read 213068 events
EXACT events/sec: 193346.6
WILDCARD events/sec: 135281.3
PREFIX events/sec: 204088.1
PREFIX_EQUALS_IGNORE_CASE_RULES events/sec: 206461.2
SUFFIX events/sec: 208890.2
SUFFIX_EQUALS_IGNORE_CASE_RULES events/sec: 218980.5
EQUALS_IGNORE_CASE events/sec: 193874.4
NUMERIC events/sec: 128199.8
ANYTHING-BUT events/sec: 134853.2
ANYTHING-BUT-IGNORE-CASE events/sec: 135195.4
ANYTHING-BUT-PREFIX events/sec: 147861.2
ANYTHING-BUT-SUFFIX events/sec: 145240.6
COMPLEX_ARRAYS events/sec: 36521.8
PARTIAL_COMBO events/sec: 53845.8
COMBO events/sec: 19746.8

From the Github benchmark:

Java 8:

Reading citylots2
Read 213068 events
EXACT events/sec: 120445.4
WILDCARD events/sec: 91210.6
PREFIX events/sec: 123374.6
PREFIX_EQUALS_IGNORE_CASE_RULES events/sec: 124383.0
SUFFIX events/sec: 118436.9
SUFFIX_EQUALS_IGNORE_CASE_RULES events/sec: 118305.4
EQUALS_IGNORE_CASE events/sec: 115484.0
NUMERIC events/sec: 83327.3
ANYTHING-BUT events/sec: 77875.7
ANYTHING-BUT-IGNORE-CASE events/sec: 76259.1
ANYTHING-BUT-PREFIX events/sec: 85261.3
ANYTHING-BUT-SUFFIX events/sec: 87287.2
COMPLEX_ARRAYS events/sec: 20178.8
PARTIAL_COMBO events/sec: 35235.3
COMBO events/sec: 13567.8

Java 11:

Reading citylots2
Read 213068 events
EXACT events/sec: 190579.6
WILDCARD events/sec: 129919.5
PREFIX events/sec: 188389.0
PREFIX_EQUALS_IGNORE_CASE_RULES events/sec: 186901.8
SUFFIX events/sec: 177704.8
SUFFIX_EQUALS_IGNORE_CASE_RULES events/sec: 181488.9
EQUALS_IGNORE_CASE events/sec: 161537.5
NUMERIC events/sec: 103884.9
ANYTHING-BUT events/sec: 101171.9
ANYTHING-BUT-IGNORE-CASE events/sec: 100125.9
ANYTHING-BUT-PREFIX events/sec: 109265.6
ANYTHING-BUT-SUFFIX events/sec: 112141.1
COMPLEX_ARRAYS events/sec: 24646.4
PARTIAL_COMBO events/sec: 42300.6
COMBO events/sec: 16163.6

Java 17:

Reading citylots2
Read 213068 events
EXACT events/sec: 190750.2
WILDCARD events/sec: 119970.7
PREFIX events/sec: 187559.9
PREFIX_EQUALS_IGNORE_CASE_RULES events/sec: 188389.0
SUFFIX events/sec: 184634.3
SUFFIX_EQUALS_IGNORE_CASE_RULES events/sec: 184314.9
EQUALS_IGNORE_CASE events/sec: 163270.5
NUMERIC events/sec: 102338.1
ANYTHING-BUT events/sec: 103986.3
ANYTHING-BUT-IGNORE-CASE events/sec: 104138.8
ANYTHING-BUT-PREFIX events/sec: 116050.1
ANYTHING-BUT-SUFFIX events/sec: 117006.0
COMPLEX_ARRAYS events/sec: 26967.2
PARTIAL_COMBO events/sec: 43572.2
COMBO events/sec: 18196.9

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Rogerio Yamaguti added 3 commits October 23, 2023 11:51
* Adding functionality for prefix/equals-ignore-case and suffix/equals-ignore-case
with the respective unit tests, benchmarks, and README updates.
* Explicitly running the benchmarks class after mvn verify is executed.
By default, the maven-surefire-plugin only runs tests with the "Test" which
ends up ignoring the Benchmarks test class.
After adding the "Run benchmarks" step on Github actions, we started seeing
failures on Ubuntu for JDK8 due to GC overhead limits. This commit changes
the command to only run CL2 benchmarks.
@rogeriosy rogeriosy marked this pull request as ready for review October 23, 2023 20:51
Copy link
Collaborator

@baldawar baldawar left a comment

Choose a reason for hiding this comment

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

LGTM, just few documentation updates would be good to merge along with this change.

@@ -588,12 +646,24 @@ public void CL2Benchmark() throws Exception {

bm = new Benchmarker();

bm.addRules(PREFIX_EQUALS_IGNORE_CASE_RULES, PREFIX_EQUALS_IGNORE_CASE_MATCHES);
bm.run(citylots2);
System.out.println("PREFIX_EQUALS_IGNORE_CASE_RULES events/sec: " + String.format("%.1f", bm.getEPS()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -45,10 +45,18 @@ public static ValuePatterns prefixMatch(final String prefix) {
return new ValuePatterns(MatchType.PREFIX, prefix);
}

public static ValuePatterns prefixEqualsIgnoreCaseMatch(final String prefix) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -29,3 +29,5 @@ jobs:
cache: 'maven'
- name: Verify with Maven
run: mvn --batch-mode --errors --update-snapshots verify
- name: Run benchmarks
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can also update the comment within this template, so folks know how to update fetch the benchmark results (for now just pasting JDK 8 results is fine)

https://github.com/aws/event-ruler/blob/main/.github/PULL_REQUEST_TEMPLATE.md

Rogerio Yamaguti added 2 commits October 24, 2023 10:57
* Updated "Performance" section on README with benchmarks results
* Updated "THe Patterns API" section on README with the new match types
* Updated PR template with instructions on where to get the benchmarks
@baldawar baldawar merged commit 4cddf22 into main Oct 24, 2023
3 checks passed
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.

None yet

3 participants