Skip to content

Commit 745bd62

Browse files
committed
Initial Performance Tests
1 parent 702521a commit 745bd62

7 files changed

Lines changed: 295 additions & 2 deletions

File tree

tests/testthat/connection_to_datasets/login_details.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if (! is.null(getOption("default_driver"))) {
1717
} else {
1818
# switch between "DSLiteDriver" and "OpalDriver", "ArmadilloDriver" to test
1919
# ds.test_env$driver <- "DSLiteDriver"
20-
ds.test_env$driver <- "OpalDriver"
21-
# ds.test_env$driver <- "ArmadilloDriver"
20+
# ds.test_env$driver <- "OpalDriver"
21+
ds.test_env$driver <- "ArmadilloDriver"
2222
}
2323

2424
if ((ds.test_env$driver == "DSLiteDriver") || (ds.test_env$driver == "OpalDriver")) {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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("conndisconn::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
disconnect.studies.dataset.cnsim()
18+
19+
#
20+
# Tests
21+
#
22+
23+
context("conndisconn::perf::simple0")
24+
test_that("simple connect - disconnect performance", {
25+
.durationSec <- 120 # seconds
26+
.count <- 0
27+
.start.time <- Sys.time()
28+
.current.time <- .start.time
29+
30+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
31+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
32+
disconnect.studies.dataset.cnsim()
33+
34+
.count <- .count + 1
35+
.current.time <- Sys.time()
36+
}
37+
expect_true(TRUE)
38+
39+
print(paste("conndisconn::perf::simple::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
40+
})
41+
42+
#
43+
# Done
44+
#
45+
46+
context("conndisconn::perf::shutdown")
47+
disconnect.studies.dataset.cnsim()
48+
context("conndisconn::perf::done")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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.class::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
context("ds.class::perf::combine:0")
23+
test_that("combine - 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.class("D$LAB_TSC")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
expect_true(TRUE)
36+
37+
print(paste("ds.class::perf::combine::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
38+
})
39+
40+
#
41+
# Done
42+
#
43+
44+
context("ds.class::perf::shutdown")
45+
disconnect.studies.dataset.cnsim()
46+
context("ds.class::perf::done")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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.exists::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
context("ds.exists::perf::combine:0")
23+
test_that("combine - 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.exists("D$LAB_TSC")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
expect_true(TRUE)
36+
37+
print(paste("ds.exists::perf::combine::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
38+
})
39+
40+
#
41+
# Done
42+
#
43+
44+
context("ds.exists::perf::shutdown")
45+
disconnect.studies.dataset.cnsim()
46+
context("ds.exists::perf::done")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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.length::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
context("ds.length::perf::combine:0")
23+
test_that("combine - 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.length("D$LAB_TSC")
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
expect_true(TRUE)
36+
37+
print(paste("ds.length::perf::combine::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
38+
})
39+
40+
#
41+
# Done
42+
#
43+
44+
context("ds.length::perf::shutdown")
45+
disconnect.studies.dataset.cnsim()
46+
context("ds.length::perf::done")

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

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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.mean::perf::setup")
16+
connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG"))
17+
18+
#
19+
# Tests
20+
#
21+
22+
context("ds.mean::perf::combine:0")
23+
test_that("combine - 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.mean("D$LAB_TSC", type='combine')
31+
32+
.count <- .count + 1
33+
.current.time <- Sys.time()
34+
}
35+
expect_true(TRUE)
36+
37+
print(paste("ds.mean::perf::combine::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
38+
})
39+
40+
context("ds.mean::perf::split:0")
41+
test_that("split - performance", {
42+
.durationSec <- 30 # seconds
43+
.count <- 0
44+
.start.time <- Sys.time()
45+
.current.time <- .start.time
46+
47+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
48+
ds.mean("D$LAB_TSC", type='split')
49+
50+
.count <- .count + 1
51+
.current.time <- Sys.time()
52+
}
53+
expect_true(TRUE)
54+
55+
print(paste("ds.mean::perf::split::0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
56+
})
57+
58+
#
59+
# Done
60+
#
61+
62+
context("ds.mean::perf::shutdown")
63+
disconnect.studies.dataset.cnsim()
64+
context("ds.mean::perf::done")

tests/testthat/test-perf-void.R

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2024 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("void::perf::setup")
16+
17+
#
18+
# Tests
19+
#
20+
21+
context("void::perf::simple0")
22+
test_that("simple void performance", {
23+
.durationSec <- 60 # seconds
24+
.count <- 0
25+
.start.time <- Sys.time()
26+
.current.time <- .start.time
27+
28+
while (difftime(.current.time, .start.time, units = "secs")[[1]] < .durationSec) {
29+
.count <- .count + 1
30+
.current.time <- Sys.time()
31+
}
32+
expect_true(TRUE)
33+
34+
print(paste("void::perf::simple0:", format(.count / (difftime(.current.time, .start.time, units = "secs")[[1]]), digits = 8)))
35+
})
36+
37+
#
38+
# Done
39+
#
40+
41+
context("void::perf::shutdown")
42+
43+
context("void::perf::done")

0 commit comments

Comments
 (0)