From 49d788170e9e220dac7bf6c0ddb6de11df91c9e3 Mon Sep 17 00:00:00 2001 From: stanbrub Date: Wed, 11 Oct 2023 17:47:42 -0600 Subject: [PATCH 1/6] Added inline formatul tests for view, update_view, select, update --- .../standard/formula/InlineFormulaTest.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java new file mode 100644 index 00000000..5424ea8c --- /dev/null +++ b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java @@ -0,0 +1,49 @@ +/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ +package io.deephaven.benchmark.tests.standard.formula; + +import org.junit.jupiter.api.*; +import io.deephaven.benchmark.tests.standard.StandardTestRunner; + +/** + * Standard tests for running basic formulas (not functions) inline for select, update, view, update_view, etc. These + * tests aggregate the resulting values to make sure the formulas are actually run (as in the case of views). Theses + * tests are meant to be compared, and so use the same data. + */ +public class InlineFormulaTest { + final StandardTestRunner runner = new StandardTestRunner(this); + final String calcs = "'New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'"; + + @BeforeEach + public void setup() { + runner.tables("source"); + } + + @Test + public void selectCalcsFormula() { + runner.setScaleFactors(120, 50); + var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calcs); + runner.test("Select-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void updateCalcsFormula() { + runner.setScaleFactors(100, 80); + var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calcs); + runner.test("Update-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void viewCalcsFormula() { + runner.setScaleFactors(120, 100); + var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calcs); + runner.test("View-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void updateViewCalcsFormula() { + runner.setScaleFactors(120, 120); + var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calcs); + runner.test("UpdateView-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + +} From d0f0969184e878344a995499ed4111b76b6b87b9 Mon Sep 17 00:00:00 2001 From: stanbrub Date: Mon, 16 Oct 2023 13:20:36 -0600 Subject: [PATCH 2/6] Re-scaled DateTimeUtil formula tests to be less variable between runs --- .../tests/standard/formula/DateTimeFormulaTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/formula/DateTimeFormulaTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/formula/DateTimeFormulaTest.java index bd4779ac..9239d9f3 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/formula/DateTimeFormulaTest.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/formula/DateTimeFormulaTest.java @@ -13,7 +13,7 @@ public class DateTimeFormulaTest { @Test public void now() { - setup(6, 40, 5); + setup(6, 35, 15); var q = "source.update(formulas=['New1 = now()'])"; runner.test("Now- now()", q, "int250"); } @@ -27,22 +27,24 @@ public void parseInstant() { @Test public void parseDuration() { - setup(3, 10, 2); + setup(2, 9, 1); var q = "source.update(formulas=['New1 = parseDuration(`PT4H52M14S`)'])"; runner.test("ParseDuration- PT Duration String", q, "int250"); } @Test public void parseLocalTime() { - setup(3, 10, 1); + setup(2, 7, 1); var q = "source.update(formulas=['New1 = parseLocalTime(`04:52:14.001`)'])"; runner.test("ParseLocalTime- Time String)", q, "int250"); } @Test public void epochNanosToZonedDateTime() { - setup(3, 8, 5); - var q = "source.update(formulas=['New1 = epochNanosToZonedDateTime(1000000, java.time.ZoneId.systemDefault())'])"; + setup(2, 11, 10); + var q = """ + source.update(formulas=['New1=epochNanosToZonedDateTime(1697240421926014741L,java.time.ZoneOffset.UTC)']) + """; runner.test("EpochNanosToZonedDateTime- Nanos Long and ZoneId", q, "int250"); } From 2325ab26d02f3b2602cc5852b0307bd3caadc4ba Mon Sep 17 00:00:00 2001 From: stanbrub Date: Mon, 16 Oct 2023 17:23:03 -0600 Subject: [PATCH 3/6] re-scaled update formula test --- .../benchmark/tests/standard/formula/InlineFormulaTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java index 5424ea8c..77e74ae3 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java @@ -27,7 +27,7 @@ public void selectCalcsFormula() { @Test public void updateCalcsFormula() { - runner.setScaleFactors(100, 80); + runner.setScaleFactors(110, 80); var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calcs); runner.test("Update-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); } From 2380eb6bcf19d1736c349fbad2cf13bb16dc5570 Mon Sep 17 00:00:00 2001 From: stanbrub Date: Mon, 16 Oct 2023 17:25:56 -0600 Subject: [PATCH 4/6] Cleaned up unneeded update/select tests --- .../tests/standard/select/SelectTest.java | 33 --------------- .../{select => sort}/SelectDistinctTest.java | 2 +- .../tests/standard/update/UpdateTest.java | 40 ------------------ .../tests/standard/update/UpdateViewTest.java | 41 ------------------- .../tests/standard/update/ViewTest.java | 40 ------------------ 5 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 src/it/java/io/deephaven/benchmark/tests/standard/select/SelectTest.java rename src/it/java/io/deephaven/benchmark/tests/standard/{select => sort}/SelectDistinctTest.java (95%) delete mode 100644 src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateTest.java delete mode 100644 src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateViewTest.java delete mode 100644 src/it/java/io/deephaven/benchmark/tests/standard/update/ViewTest.java diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectTest.java deleted file mode 100644 index 477451df..00000000 --- a/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.select; - -import org.junit.jupiter.api.*; -import io.deephaven.benchmark.tests.standard.StandardTestRunner; - -/** - * Standard tests for the select table operation. Creates a new in-memory table that includes one column for each - * argument - */ -public class SelectTest { - final StandardTestRunner runner = new StandardTestRunner(this); - - @BeforeEach - public void setup() { - runner.tables("source"); - } - - @Test - public void select1CalcUsing2Cols() { - runner.setScaleFactors(200, 40); - var q = "source.select(formulas=['New1 = (float)((int640 + int250) / 2)'])"; - runner.test("Select- 1 Calc Using 2 Cols", q, "int250", "int640"); - } - - @Test - public void select2CalcsUsing2Cols() { - runner.setScaleFactors(100, 20); - var q = "source.select(formulas=['New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'])"; - runner.test("Select- 2 Cals Using 2 Cols", q, "int250", "int640"); - } - -} diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java similarity index 95% rename from src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java rename to src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java index f4306fd6..06a18cb9 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java @@ -1,5 +1,5 @@ /* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.select; +package io.deephaven.benchmark.tests.standard.sort; import org.junit.jupiter.api.*; import io.deephaven.benchmark.tests.standard.StandardTestRunner; diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateTest.java deleted file mode 100644 index 9f1fdc97..00000000 --- a/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.update; - -import org.junit.jupiter.api.*; -import io.deephaven.benchmark.tests.standard.StandardTestRunner; - -/** - * Standard tests for the update table operation. Creates a new table containing a new, in-memory column for each - * argument - */ -public class UpdateTest { - final StandardTestRunner runner = new StandardTestRunner(this); - - @BeforeEach - public void setup() { - runner.tables("source"); - } - - @Test - public void update1CalcUsing2Cols() { - runner.setScaleFactors(200, 40); - var q = "source.update(formulas=['New1 = (float)((int640 + int250) / 2)'])"; - runner.test("Update- 1 Calc Using 2 Cols", q, "int250", "int640"); - } - - @Test - public void update2CalcsInt() { - runner.setScaleFactors(100, 20); - var q = "source.update(formulas=['New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'])"; - runner.test("Update- 2 Calcs Using Int", q, "int250", "int640"); - } - - @Test - public void update2CalcsFloat() { - runner.setScaleFactors(100, 20); - var q = "source.update(formulas=['New1 = (float)((float5 + int250) / 2)', 'New2 = float5 - int250'])"; - runner.test("Update- 2 Calcs Using Float", q, "int250", "float5"); - } - -} diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateViewTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateViewTest.java deleted file mode 100644 index a0737bb8..00000000 --- a/src/it/java/io/deephaven/benchmark/tests/standard/update/UpdateViewTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.update; - -import org.junit.jupiter.api.*; -import io.deephaven.benchmark.tests.standard.StandardTestRunner; - -/** - * Standard tests for the update_view table operation. Creates a new table containing a new formula column for each - * argument - */ -public class UpdateViewTest { - final StandardTestRunner runner = new StandardTestRunner(this); - - @BeforeEach - public void setup() { - runner.setRowFactor(6); - runner.tables("source"); - } - - @Test - public void updateView1CalcUsing2Cols() { - runner.setScaleFactors(200, 40); - var q = "source.update_view(formulas=['New1 = (int640 + int250) / 2'])"; - runner.test("UpdateView- 1 Calc Using 2 Cols", q, "str250", "int250", "int640", "int1M"); - } - - @Test - public void updateView2CalcsInt() { - runner.setScaleFactors(100, 20); - var q = "source.update_view(formulas=['New1 = (int640 + int250) / 2', 'New2 = int1M - int640'])"; - runner.test("UpdateView- 2 Cals Using Int", q, "str250", "int250", "int640", "int1M"); - } - - @Test - public void updateView2CalcsFloat() { - runner.setScaleFactors(100, 20); - var q = "source.update_view(formulas=['New1 = (float5 + int250) / 2', 'New2 = int1M - float5'])"; - runner.test("UpdateView- 2 Calcs Using Float", q, "str250", "int250", "float5", "int1M"); - } - -} diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/update/ViewTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/update/ViewTest.java deleted file mode 100644 index ab6838c3..00000000 --- a/src/it/java/io/deephaven/benchmark/tests/standard/update/ViewTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.update; - -import org.junit.jupiter.api.*; -import io.deephaven.benchmark.tests.standard.StandardTestRunner; - -/** - * Standard tests for the view table operation. Creates a new formula table that includes one column for each argument - */ -public class ViewTest { - final StandardTestRunner runner = new StandardTestRunner(this); - - @BeforeEach - public void setup() { - runner.setRowFactor(6); - runner.tables("source"); - } - - @Test - public void view1CalcUsing2Cols() { - runner.setScaleFactors(200, 40); - var q = "source.view(formulas=['New1 = (int640 + int250) / 2'])"; - runner.test("View- 1 Calc Using 2 Cols", q, "str250", "int250", "int640", "int1M"); - } - - @Test - public void view2CalcsInt() { - runner.setScaleFactors(100, 20); - var q = "source.view(formulas=['New1 = (int640 + int250) / 2', 'New2 = int1M - int640'])"; - runner.test("View- 2 Cals Using 2 Cols", q, "str250", "int250", "int640", "int1M"); - } - - @Test - public void view2CalcsFloat() { - runner.setScaleFactors(100, 20); - var q = "source.view(formulas=['New1 = (float5 + int250) / 2', 'New2 = int1M - float5'])"; - runner.test("View- 2 Calcs Using Float", q, "str250", "int250", "float5", "int1M"); - } - -} From 6d9cb8083ed4b34775ffb49c1bdb0a89f7919ea2 Mon Sep 17 00:00:00 2001 From: stanbrub Date: Mon, 23 Oct 2023 23:19:34 -0600 Subject: [PATCH 5/6] Moved select-distinct to its own package --- .../tests/standard/{sort => select}/SelectDistinctTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/it/java/io/deephaven/benchmark/tests/standard/{sort => select}/SelectDistinctTest.java (95%) diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java similarity index 95% rename from src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java rename to src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java index 06a18cb9..f4306fd6 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/sort/SelectDistinctTest.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/select/SelectDistinctTest.java @@ -1,5 +1,5 @@ /* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */ -package io.deephaven.benchmark.tests.standard.sort; +package io.deephaven.benchmark.tests.standard.select; import org.junit.jupiter.api.*; import io.deephaven.benchmark.tests.standard.StandardTestRunner; From 4cfd19a0b7d5a1a1be04234688726080d417c3f5 Mon Sep 17 00:00:00 2001 From: stanbrub Date: Thu, 26 Oct 2023 17:06:46 -0600 Subject: [PATCH 6/6] Added more update/select/etc benchmarks and scaled --- .../standard/formula/InlineFormulaTest.java | 96 +++++++++++++++---- 1 file changed, 77 insertions(+), 19 deletions(-) diff --git a/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java index 77e74ae3..5152fd80 100644 --- a/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java +++ b/src/it/java/io/deephaven/benchmark/tests/standard/formula/InlineFormulaTest.java @@ -6,44 +6,102 @@ /** * Standard tests for running basic formulas (not functions) inline for select, update, view, update_view, etc. These - * tests aggregate the resulting values to make sure the formulas are actually run (as in the case of views). Theses + * tests aggregate the resulting values to make sure the formulas are actually run (as in the case of views). These * tests are meant to be compared, and so use the same data. */ public class InlineFormulaTest { final StandardTestRunner runner = new StandardTestRunner(this); - final String calcs = "'New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'"; - + final String calc1col1 = "'New1 = (float)((int640 + int640) / 2)'"; + final String calc1cols2 = "'New1 = (float)((int640 + int250) / 2)'"; + final String calc2cols2 = "'New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'"; + @BeforeEach public void setup() { runner.tables("source"); } @Test - public void selectCalcsFormula() { + public void select1Calc1ColFormula() { + runner.setScaleFactors(160, 60); + var q = "source.select(['int640',${calcs}]).sum_by()".replace("${calcs}", calc1col1); + runner.test("Select-Sum- 1 Calc Using 1 Col", 1, q, "int640"); + } + + @Test + public void select1Calc2ColsFormula() { + runner.setScaleFactors(120, 50); + var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc1cols2); + runner.test("Select-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void select2Calcs2ColsFormula() { runner.setScaleFactors(120, 50); - var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calcs); - runner.test("Select-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc2cols2); + runner.test("Select-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); } - + + @Test + public void update1Calc1ColsFormula() { + runner.setScaleFactors(160, 130); + var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc1col1); + runner.test("Update-Sum- 1 Calc Using 1 Col", 1, q, "int640"); + } + @Test - public void updateCalcsFormula() { + public void update1Calc2ColsFormula() { + runner.setScaleFactors(140, 100); + var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc1cols2); + runner.test("Update-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void update2Calcs2ColsFormula() { runner.setScaleFactors(110, 80); - var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calcs); - runner.test("Update-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc2cols2); + runner.test("Update-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void view1Calc1ColFormula() { + runner.setScaleFactors(130, 120); + var q = "source.view(['int640',${calcs}]).sum_by()".replace("${calcs}", calc1col1); + runner.test("View-Sum- 1 Calc Using 1 Col", 1, q, "int640"); + } + + @Test + public void view1Calc2ColsFormula() { + runner.setScaleFactors(120, 120); + var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc1cols2); + runner.test("View-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640"); } - + @Test - public void viewCalcsFormula() { + public void view2Calcs2ColsFormula() { runner.setScaleFactors(120, 100); - var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calcs); - runner.test("View-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc2cols2); + runner.test("View-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + } + + @Test + public void updateView1Calc1ColFormula() { + runner.setScaleFactors(140, 140); + var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc1col1); + runner.test("UpdateView-Sum- 1 Calc Using 1 Col", 1, q, "int640"); + } + + @Test + public void updateView1Calc2ColsFormula() { + runner.setScaleFactors(120, 120); + var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc1cols2); + runner.test("UpdateView-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640"); } - + @Test - public void updateViewCalcsFormula() { + public void updateView2Calcs2ColsFormula() { runner.setScaleFactors(120, 120); - var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calcs); - runner.test("UpdateView-Sum 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); + var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc2cols2); + runner.test("UpdateView-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640"); } - + }