Skip to content

Commit

Permalink
added performance testing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
oena committed Jul 16, 2018
1 parent 37b86cd commit 216dea0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
26 changes: 26 additions & 0 deletions performance_testing/R_parse_timing_script.R
@@ -0,0 +1,26 @@
# Note. '/path/with/gctx/files/to/test/*gct*' refers to a directory of GCT and/or GCTx files to time parsing operations on.

library(cmapR)

# for storing timing results
input_filenames <- c()
parse_times <-c()

# get all GCT and/or GCTx files in directory
input_files <- list.files(path="/path/with/gctx/files/to/test",
pattern="*.gct*",
full.names=TRUE,
recursive=FALSE)

for (f in input_files) {
start_time <- Sys.time()
in_gctoo <- parse.gctx(f)
end_time <- Sys.time()
elapsed_time <- end_time - start_time

input_filenames <- c(input_filenames, f)
parse_times <- c(parse_times, elapsed_time)
}

parse_timing_df <- as.data.frame(cbind(input_filenames, parse_times))
write.table(parse_timing_df, "R_parsing_results.txt", sep="\t", quote=FALSE, row.names = FALSE)
40 changes: 40 additions & 0 deletions performance_testing/R_write_timing_script.R
@@ -0,0 +1,40 @@
# '/path/to/large/gctx/file' refers to a large GCTX file (any size above 10174x100000 should work) from which file subsets are made.
# In testing, the large GCTX file used lacked metadata; including metadata would cause slight variation in results.
# Cache was cleared in between consecutive operations.

library(cmapR)

in_filenames = c()
gct_write_results = c()
gctx_write_results = c()

large_gctx = parse.gctx("/path/to/large/gctx/file")

col_spaces = c(96, 384, 1536, 3000, 6000, 12000, 24000, 48000, 100000)
row_spaces = c(978, 10174)

for (c in col_spaces) {
for (r in row_spaces) {
curr_gctoo = subset.gct(large_gctx, rid = 1:r, cid = 1:c)
out_fname = paste("write_test_n", paste(c, r, sep="x"), sep="_")

# gctx writing
start = Sys.time()
write.gctx(curr_gctoo, out_fname)
end = Sys.time()
gct_elapsed_time = end - start

# gct writing
start = Sys.time()
write.gct(curr_gctoo, out_fname)
end = Sys.time()
gctx_elapsed_time = end - start

in_filenames = c(in_filenames, paste(c, r, sep="x"))
gct_write_results = c(gct_write_results, gct_elapsed_time)
gctx_write_results = c(gctx_write_results, gctx_elapsed_time)
}
}

write_results_df = as.data.frame(cbind(in_filenames, gct_write_results, gctx_write_results))
write.table(write_results_df, "R_writing_results.txt", sep="\t", quote=FALSE, row.names=FALSE)

0 comments on commit 216dea0

Please sign in to comment.