[H5r-commits] r33 - R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 15 17:28:46 CEST 2010
Author: extemporaneousb
Date: 2010-06-15 17:28:46 +0200 (Tue, 15 Jun 2010)
New Revision: 33
Modified:
R/h5R.R
inst/performance.R
Log:
Performance Enhancements
Modified: R/h5R.R
===================================================================
--- R/h5R.R 2010-06-08 19:40:45 UTC (rev 32)
+++ R/h5R.R 2010-06-15 15:28:46 UTC (rev 33)
@@ -460,10 +460,17 @@
} else {
dim <- NA
}
- list(name = a[[1]], type = a[[2]], attributes = .listH5Attributes(h5Obj),
+ list(name = a[[1]],
+ type = a[[2]],
+ attributes = .listH5Attributes(h5Obj),
dim = dim)
})
names(lst) <- sapply(lst, "[[", 1)
+ lst <- lapply(lst, function(a) {
+ a$name <- basename(a$name)
+ a
+ })
+
return(lst)
}
Modified: inst/performance.R
===================================================================
--- inst/performance.R 2010-06-08 19:40:45 UTC (rev 32)
+++ inst/performance.R 2010-06-15 15:28:46 UTC (rev 33)
@@ -10,38 +10,32 @@
cDtas <- lapply(paste("cdata", chunks, sep = "_"), function(n) getH5Dataset(h5, n, inMemory = FALSE))
names(cDtas) <- chunks
-N <- 1000
-K <- 1000
-
-f <- function(d, n = N, mu = 1000) {
+f <- function(d, n = 100, mu = 1000) {
start <- runif(n, 1, length(d))
- end <- start + round(rexp(n, 1/mu))
- end <- ifelse(end > length(d), start, end)
+ end <- start + round(rexp(n, 1/mu))
+ end <- ifelse(end > length(d), start, end)
+ width <- end - start + 1
- mapply(function(s,e) {
- z <- d[s:e]
- }, start, end)
-
+ lapply(seq.int(1, n), function(i) {
+ readSlab(d, start[i], width[i])
+ return(NULL)
+ })
return(TRUE)
}
-g <- function(d, n = N, mu = 1000) {
- start <- runif(n, 1, length(d))
- end <- start + round(rexp(n, 1/mu))
- end <- ifelse(end > length(d), start, end)
-
- mapply(function(s,e) {
- z <- d[matrix(c(s,e), ncol = 2)]
- }, start, end)
+times <- replicate(100, {
+ system.time(f(cDtas[[1]], n = 1000))[3]
+})
- return(TRUE)
-}
+pyTimes <- scan("pyres.txt")
-system.time(f(cDtas[[1]], n = 100000))
-system.time(g(cDtas[[1]], n = 100000))
+png("numpyVR.png")
+par(mar = c(8, 6, 5, 1), cex.lab = 2, cex.axis = 2, cex.main = 2)
+boxplot(list("Python" = pyTimes, "R" = times), ylim = c(.075, .15),
+ las = 2, main = "Random 1k dataset slice")
+dev.off()
-
Rprof("rprof")
levelplot(x <- do.call(rbind, lapply(cDtas, function(a) {
set.seed(10)
More information about the H5r-commits
mailing list