Skip to content

Commit 520701d

Browse files
committed
test: add performance tests for batch 4 functions
1 parent 58f6ee3 commit 520701d

15 files changed

Lines changed: 885 additions & 0 deletions
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.Boole::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.Boole::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.Boole("D$LAB_TSC", "D$LAB_TRIG", Boolean.operator="==", newobj="boole.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.Boole::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.Boole::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.Boole::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.Boole::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.Boole::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.Boole::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.Boole::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.Boole::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.Boole::perf::done")

tests/testthat/test-perf-ds.c.R

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.c::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.c::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.c("D\$LAB_TSC", "D\$LAB_TRIG", newobj="c.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.c::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.c::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.c::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.c::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.c::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.c::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.c::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.c::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.c::perf::done")
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.cbind::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.cbind::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.cbind(x=c("D\$LAB_TSC", "D\$LAB_TRIG"), newobj="cbind.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.cbind::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.cbind::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.cbind::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.cbind::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.cbind::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.cbind::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.cbind::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.cbind::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.cbind::perf::done")
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.dataFrame::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.dataFrame::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.dataFrame(x=c("D\$LAB_TSC", "D\$LAB_TRIG"), newobj="df.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.dataFrame::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.dataFrame::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.dataFrame::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.dataFrame::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.dataFrame::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.dataFrame::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.dataFrame::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.dataFrame::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.dataFrame::perf::done")
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.dataFrameFill::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.dataFrameFill::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.dataFrameFill("D", newobj="fill.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.dataFrameFill::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.dataFrameFill::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.dataFrameFill::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.dataFrameFill::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.dataFrameFill::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.dataFrameFill::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.dataFrameFill::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.dataFrameFill::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.dataFrameFill::perf::done")
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
3+
#
4+
# This program and the accompanying materials
5+
# are made available under the terms of the GNU Public License v3.0.
6+
#
7+
# You should have received a copy of the GNU General Public License
8+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
9+
#-------------------------------------------------------------------------------
10+
11+
#
12+
# Set up
13+
#
14+
15+
# context("ds.dataFrameSort::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
# context("ds.dataFrameSort::perf::0")
23+
test_that("performance", {
24+
.durationSec <- 30 # seconds
25+
.count <- 0
26+
.start.time <- Sys.time()
27+
.current.time <- .start.time
28+
29+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
30+
ds.dataFrameSort(df.name="D", sort.key.name="D\$LAB_TSC", newobj="sorted.newobj")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
36+
.current.rate <- .count / (difftime(.current.time, .start.time, units = "secs")[[1]])
37+
.reference.rate <- perf.reference.rate("ds.dataFrameSort::perf::0")
38+
if (any(length(.reference.rate) == 0) || any(is.null(.reference.rate))) {
39+
print(paste("ds.dataFrameSort::perf::0 ", .current.rate, 0.5, 2.0))
40+
perf.reference.save("ds.dataFrameSort::perf::0", .current.rate, 0.5, 2.0)
41+
} else {
42+
print(paste("ds.dataFrameSort::perf::0 ", format(.current.rate, digits = 8), ", ", format(100.0 * .current.rate / .reference.rate, digits = 4), "%", sep = ''))
43+
}
44+
45+
.reference.rate <- perf.reference.rate("ds.dataFrameSort::perf::0")
46+
.reference.tolerance.lower <- perf.reference.tolerance.lower("ds.dataFrameSort::perf::0")
47+
.reference.tolerance.upper <- perf.reference.tolerance.upper("ds.dataFrameSort::perf::0")
48+
49+
expect_gt(.current.rate, .reference.rate * .reference.tolerance.lower, label = "Observed rate", expected.label = "lower threshold on rate")
50+
expect_lt(.current.rate, .reference.rate * .reference.tolerance.upper, label = "Observed rate", expected.label = "upper threshold on rate")
51+
})
52+
53+
#
54+
# Done
55+
#
56+
57+
# context("ds.dataFrameSort::perf::shutdown")
58+
disconnect.studies.dataset.cnsim()
59+
# context("ds.dataFrameSort::perf::done")

0 commit comments

Comments
 (0)