Skip to content

Commit 1bb8941

Browse files
committed
Update to perf config
1 parent 79ddad0 commit 1bb8941

9 files changed

Lines changed: 69 additions & 19 deletions

tests/testthat/perf_files/armadillo_azure-pipeline.csv renamed to tests/testthat/perf_files/armadillo_azure-pipeline_perf-profile.csv

File renamed without changes.

tests/testthat/perf_files/armadillo_hp-laptop_quay.csv renamed to tests/testthat/perf_files/armadillo_hp-laptop-quay_pipeline-perf.csv

File renamed without changes.

tests/testthat/perf_files/template_perf_profile.csv renamed to tests/testthat/perf_files/default_template_perf-profile.csv

File renamed without changes.

tests/testthat/perf_files/dslite_hp-laptop_quay.csv renamed to tests/testthat/perf_files/dslite_hp-laptop-quay_perf-profile.csv

File renamed without changes.

tests/testthat/perf_files/opal_azure-pipeline.csv renamed to tests/testthat/perf_files/opal_azure-pipeline_perf-profile.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"refer_name","rate","lower_tolerance","upper_tolerance"
22
"conndisconn::perf::simple0","0.1654","0.5","2"
33
"ds.abs::perf::0","17.30","0.5","2"
4-
"ds.asCharacter::perf:0","16.75","0.5","2"
4+
"ds.asCharacter::perf::0","16.75","0.5","2"
55
"ds.asDataMatrix::perf:0","17.34","0.5","2"
66
"ds.asInteger::perf:0","17.30","0.5","2"
77
"ds.asList::perf:0","16.63","0.5","2"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"refer_name","rate","lower_tolerance","upper_tolerance"
2+
"conndisconn::perf::simple0","0.1340","0.5","2"
3+
"ds.abs::perf::0","2.822","0.5","2"
4+
"ds.asCharacter::perf::0","2.393","0.5","2"
5+
"ds.asDataMatrix::perf::0","2.554","0.5","2"
6+
"ds.asInteger::perf:0","3.056","0.5","2"
7+
"ds.asList::perf:0","2.649","0.5","2"
8+
"ds.asLogical::perf::0","2.629","0.5","2"
9+
"ds.asMatrix::perf::0","2.717","0.5","2"
10+
"ds.asNumeric::perf:0","2.629","0.5","2"
11+
"ds.assign::perf::0","1.709","0.5","2"
12+
"ds.class::perf::combine:0","3.216","0.5","2"
13+
"ds.colnames::perf:0","0.941","0.5","2"
14+
"ds.completeCases::perf::combine:0","2.660","0.5","2"
15+
"ds.dim::perf::combine:0","25.31","0.5","2"
16+
"ds.exists::perf::combine:0","3.493","0.5","2"
17+
"ds.exp::perf::combine:0","17.90","0.5","2"
18+
"ds.isNA::perf::combine:0","25.43","0.5","2"
19+
"ds.length::perf::combine:0","25.44","0.5","2"
20+
"ds.levels::perf::combine:0","3.275","0.5","2"
21+
"ds.log::perf::0","17.89","0.5","2"
22+
"ds.ls::perf::combine:0","2.857","0.5","2"
23+
"ds.mean::perf::combine:0","2.756","0.5","2"
24+
"ds.mean::perf::split:0","3.547","0.5","2"
25+
"ds.names::perf::combine:0","2.246","0.5","2"
26+
"ds.numNA::perf::combine:0","25.46","0.5","2"
27+
"ds.sqrt::perf::0","2.686","0.5","2"
28+
"ds.unique::perf::combine:0","2.681","0.5","2"
29+
"void::perf::void::0","20150","0.5","2"

tests/testthat/perf_files/opal_hp-laptop_quay.csv

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/testthat/perf_files/default_perf_profile.csv renamed to tests/testthat/perf_files/unknown_default-perf-profile.csv

File renamed without changes.

tests/testthat/perf_tests/perf_rate.R

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2024-2025 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
2+
# Copyright (c) 2024-2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the GNU Public License v3.0.
@@ -8,12 +8,36 @@
88
# along with this program. If not, see <http://www.gnu.org/licenses/>.
99
#-------------------------------------------------------------------------------
1010

11-
.perf.reference.filename <- 'perf_files/default_perf_profile.csv'
11+
.perf.reference.filename.base.prefix <- 'perf_files/'
12+
.perf.reference.filename.base.postfix <- '_perf-profile.csv'
13+
.perf.reference.save.filename <- NULL
1214

1315
.perf.reference <- NULL
1416

1517
.load.pref <- function() {
16-
.perf.reference <<- read.csv(.perf.reference.filename, header = TRUE, sep = ",")
18+
if (ds.test_env$driver == "OpalDriver")
19+
perf.reference.filename.driver.infix <- "opal"
20+
else if (ds.test_env$driver == "ArmadilloDriver")
21+
perf.reference.filename.driver.infix <- "armadillo"
22+
else if (ds.test_env$driver == "DSLiteDriver")
23+
perf.reference.filename.driver.infix <- "dslite"
24+
else
25+
{
26+
perf.reference.filename.infix <- "unknown"
27+
warning("Unknown performance profile driver, using 'unknown'")
28+
}
29+
30+
perf.profile <- base::Sys.getenv("PERF_PROFILE")
31+
if (nchar(perf.profile) > 0)
32+
perf.reference.filename.platform.infix <- base::tolower(perf.profile)
33+
else
34+
{
35+
perf.reference.filename.platform.infix <- "default"
36+
warning("Unknown performance profile platform, using 'default'")
37+
}
38+
39+
perf.reference.filename <- paste(.perf.reference.filename.base.prefix, perf.reference.filename.driver.infix, '_', perf.reference.filename.platform.infix, .perf.reference.filename.base.postfix, sep = "")
40+
.perf.reference <<- read.csv(perf.reference.filename, header = TRUE, sep = ",")
1741
}
1842

1943
perf.reference.save <- function(perf.ref.name, rate, tolerance.lower, tolerance.upper) {
@@ -22,11 +46,22 @@ perf.reference.save <- function(perf.ref.name, rate, tolerance.lower, tolerance.
2246

2347
.perf.reference[nrow(.perf.reference)+1,] <- c(perf.ref.name, rate, tolerance.lower, tolerance.upper)
2448

25-
write.csv(.perf.reference, .perf.reference.filename, row.names = FALSE)
49+
if (is.null(.perf.reference.save.filename))
50+
{
51+
.perf.reference.save.filename <<- base::tempfile(pattern = "perf_file_", fileext = ".csv")
52+
message(paste0("Additional perf record added to '", .perf.reference.save.filename, "'"))
53+
}
54+
55+
write.csv(.perf.reference, .perf.reference.save.filename, row.names = FALSE)
2656

2757
.perf.reference <<- .perf.reference
2858
}
2959

60+
# Obtain performance test duration from PERF_DURATION_SEC environment variable, otherwise default.duration argument, otherwise "30".
61+
perf.testduration <- function(default.duration = 30) {
62+
base::as.integer(base::Sys.getenv("PERF_DURATION_SEC", unset = base::as.character(default.duration)))
63+
}
64+
3065
perf.reference.rate <- function(perf.ref.name) {
3166
if (is.null(.perf.reference))
3267
.load.pref()

0 commit comments

Comments
 (0)