[H5r-commits] r26 - inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon May 24 19:31:11 CEST 2010
Author: extemporaneousb
Date: 2010-05-24 19:31:11 +0200 (Mon, 24 May 2010)
New Revision: 26
Modified:
inst/makeBigH5.py
inst/performance.R
Log:
Added some performance code.
Modified: inst/makeBigH5.py
===================================================================
--- inst/makeBigH5.py 2010-05-21 23:21:54 UTC (rev 25)
+++ inst/makeBigH5.py 2010-05-24 17:31:11 UTC (rev 26)
@@ -1,7 +1,8 @@
from h5py import *
from numpy import *
+import glob
-h5 = File("big.h5")
+h5 = File(glob.glob("~/h5_files/big.h5"))
x = random.randint(0, 1e5, 1e9)
## with chunks.
@@ -13,6 +14,9 @@
## zipped
h5.create_dataset("zdata", data = x, compression = 'gzip')
+## performance.
+
+
h5.close()
Modified: inst/performance.R
===================================================================
--- inst/performance.R 2010-05-21 23:21:54 UTC (rev 25)
+++ inst/performance.R 2010-05-24 17:31:11 UTC (rev 26)
@@ -1,33 +1,37 @@
##
## Investigate performance profiles of various access patterns.
##
-
require(h5r)
+h5 <- H5File(Sys.glob("~/h5_files/big.h5"))
-h5 <- H5File("big.h5")
-
cD <- getH5Dataset(h5, "cdata", inMemory = FALSE)
uD <- getH5Dataset(h5, "udata", inMemory = FALSE)
zD <- getH5Dataset(h5, "zdata", inMemory = FALSE)
+mD <- getH5Dataset(h5, "cdata", inMemory = TRUE)
-f <- function(d, N = 1000, mu = 1000) {
- start <- runif(N, 1, length(d))
- end <- start + round(rexp(N, 1/mu))
+N <- 10
+K <- 1000
+
+f <- function(d, n = N, mu = 1000) {
+ start <- runif(n, 1, length(d))
+ end <- start + round(rexp(n, 1/mu))
+
mapply(function(s,e) {
z <- d[s:e]
}, start, end)
- 1
+
+ return(TRUE)
}
-boxplot(as.data.frame(do.call(rbind, sapply(1:10, function(i) {
- set.seed(i)
- cT <- system.time(f(cD))[3]
- uT <- system.time(f(uD))[3]
- zD <- system.time(f(zD))[3]
- list(cT, uT, zD)
-}))))
+par(mar=c(10, 5, 3, 3))
+boxplot(as.data.frame(do.call(rbind, lapply(1:K, function(i) {
+ sapply(list("chunked" = cD, "unchunked" = uD, "zipped" = zD, "memory" = mD), function(a) {
+ set.seed(i)
+ system.time(f(a))[3]/N
+ })
+}))), las = 2)
+
-
More information about the H5r-commits
mailing list