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

Splitting benchmark for numbers and complex arrays. #40

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,11 @@ prefix-match, suffix-match, equals-ignore-case-match, wildcard-match, numeric-ma
counts the matches, yields the following on a 2019 MacBook:

Events are processed at over 220K/second except for:
- equals-ignore-case matches, which are processed at over 180K/second.
- equals-ignore-case matches, which are processed at over 200K/second.
- wildcard matches, which are processed at over 170K/second.
- anything-but matches, which are processed at over 110K/second.
- numeric matches, which are processed at over 2.5K/second.
- anything-but matches, which are processed at over 150K/second.
- numeric matches, which are processed at over 120K/second.
- complex array matches, which are processed at over 2.5K/second.

### Suggestions for better performance

Expand Down
Binary file modified src/test/data/citylots2.json.gz
Binary file not shown.
63 changes: 61 additions & 2 deletions src/test/software/amazon/event/ruler/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public class Benchmarks {
};
private final int[] EQUALS_IGNORE_CASE_MATCHES = { 131, 211, 1758, 825, 116386 };

private final String[] NUMERIC_RULES = {
private final String[] COMPLEX_ARRAYS_RULES = {
"{\n" +
" \"geometry\": {\n" +
" \"type\": [ \"Polygon\" ],\n" +
Expand Down Expand Up @@ -223,7 +223,48 @@ public class Benchmarks {
" }\n" +
"}"
};
private final int[] NUMERIC_MATCHES = { 227, 2, 149444, 64368, 127485 };
private final int[] COMPLEX_ARRAYS_MATCHES = { 227, 2, 149444, 64368, 127485 };

private final String[] NUMERIC_RULES = {
"{\n" +
" \"geometry\": {\n" +
" \"type\": [ \"Polygon\" ],\n" +
" \"firstCoordinates\": {\n" +
" \"x\": [ { \"numeric\": [ \"=\", -122.42916360922355 ] } ]\n" +
" }\n" +
" }\n" +
"}",
"{\n" +
" \"geometry\": {\n" +
" \"type\": [ \"MultiPolygon\" ],\n" +
" \"firstCoordinates\": {\n" +
" \"z\": [ { \"numeric\": [ \"=\", 0 ] } ]\n" +
" }\n" +
" }\n" +
"}",
"{\n" +
" \"geometry\": {\n" +
" \"firstCoordinates\": {\n" +
" \"x\": [ { \"numeric\": [ \"<\", -122.41600944012424 ] } ]\n" +
" }\n" +
" }\n" +
"}",
"{\n" +
" \"geometry\": {\n" +
" \"firstCoordinates\": {\n" +
" \"x\": [ { \"numeric\": [ \">\", -122.41600944012424 ] } ]\n" +
" }\n" +
" }\n" +
"}",
"{\n" +
" \"geometry\": {\n" +
" \"firstCoordinates\": {\n" +
" \"x\": [ { \"numeric\": [ \">\", -122.46471267081272, \"<\", -122.4063085128395 ] } ]\n" +
" }\n" +
" }\n" +
"}"
};
private final int[] NUMERIC_MATCHES = { 8, 120, 148943, 64120, 127053 };

private final String[] ANYTHING_BUT_RULES = {
"{\n" +
Expand Down Expand Up @@ -476,10 +517,28 @@ public void CL2Benchmark() throws Exception {

bm = new Benchmarker();

bm.addRules(COMPLEX_ARRAYS_RULES, COMPLEX_ARRAYS_MATCHES);
bm.run(citylots2);
System.out.println("COMPLEX_ARRAYS events/sec: " + String.format("%.1f", bm.getEPS()));

// skips complex arrays matchers because their slowness can hide improvements
// and regressions for other matchers. Remove this once we find ways to make
// arrays fast enough to others matchers
bm = new Benchmarker();

bm.addRules(NUMERIC_RULES, NUMERIC_MATCHES);
bm.addRules(EXACT_RULES, EXACT_MATCHES);
bm.addRules(PREFIX_RULES, PREFIX_MATCHES);
bm.addRules(ANYTHING_BUT_RULES, ANYTHING_BUT_MATCHES);
bm.run(citylots2);
System.out.println("PARTIAL_COMBO events/sec: " + String.format("%.1f", bm.getEPS()));

bm = new Benchmarker();
bm.addRules(NUMERIC_RULES, NUMERIC_MATCHES);
bm.addRules(EXACT_RULES, EXACT_MATCHES);
bm.addRules(PREFIX_RULES, PREFIX_MATCHES);
bm.addRules(ANYTHING_BUT_RULES, ANYTHING_BUT_MATCHES);
bm.addRules(COMPLEX_ARRAYS_RULES, COMPLEX_ARRAYS_MATCHES);
bm.run(citylots2);
System.out.println("COMBO events/sec: " + String.format("%.1f", bm.getEPS()));
}
Expand Down