[Rspatial-devel] new("SpatialGridDataFrame") time issue
Roger Bivand
Roger.Bivand at nhh.no
Sun Jan 22 21:17:48 CET 2012
Hi,
Working with Rainer Krug on making readRAST6() in spgrass6 faster, we've
identified an issue with time wasting in creating SGDF. For 2.14.1, sp
0.9-93, rgdal 0.7-8:
> Rprof("readGDAL.out")
> system.time(for (i in 1:50) SP27GTIF <-
readGDAL(system.file("pictures/SP27GTIF.TIF", package = "rgdal")[1]))
user system elapsed
122.961 4.678 131.383
> Rprof("")
> summaryRprof("readGDAL.out")
$by.self
self.time self.pct total.time total.pct
"getGridIndex" 32.32 25.31 45.44 35.59
"asMethod" 10.60 8.30 119.04 93.23
"slot<-" 8.50 6.66 8.64 6.77
"apply" 7.52 5.89 15.12 11.84
"validityMethod" 7.24 5.67 120.30 94.22
".local" 6.40 5.01 22.92 17.95
"structure" 5.56 4.35 5.58 4.37
"expand.grid" 5.14 4.03 12.72 9.96
"FUN" 4.86 3.81 4.86 3.81
"initialize" 4.34 3.40 123.08 96.40
"SpatialPixels" 3.06 2.40 96.18 75.33
"aperm.default" 2.70 2.11 2.70 2.11
"SpatialPoints" 2.54 1.99 49.16 38.50
"gc" 2.52 1.97 2.52 1.97
....
$by.total
total.time total.pct self.time self.pct
"system.time" 127.68 100.00 0.00 0.00
"readGDAL" 127.64 99.97 0.00 0.00
"new" 123.10 96.41 0.02 0.02
"initialize" 123.08 96.40 4.34 3.40
"SpatialGridDataFrame" 123.04 96.37 0.00 0.00
"validObject" 120.42 94.31 0.00 0.00
"validityMethod" 120.30 94.22 7.24 5.67
"anyStrings" 120.30 94.22 0.00 0.00
"as" 119.08 93.26 0.00 0.00
"asMethod" 119.04 93.23 10.60 8.30
"SpatialPixels" 96.18 75.33 3.06 2.40
"nrow" 96.18 75.33 0.00 0.00
"SpatialGrid" 59.22 46.38 0.00 0.00
"SpatialPoints" 49.16 38.50 2.54 1.99
"getGridIndex" 45.44 35.59 32.32 25.31
"standardGeneric" 27.94 21.88 0.00 0.00
"is" 26.28 20.58 0.02 0.02
".local" 22.92 17.95 6.40 5.01
"coordinates" 22.92 17.95 0.00 0.00
"do.call" 16.48 12.91 0.00 0.00
".bboxCoords" 15.16 11.87 0.02 0.02
"t" 15.14 11.86 0.02 0.02
"apply" 15.12 11.84 7.52 5.89
"expand.grid" 12.72 9.96 5.14 4.03
"slot<-" 8.64 6.77 8.50 6.66
"structure" 5.58 4.37 5.56 4.35
The getGridIndex() call is particularly odd, taking 25% of execution time.
I've put the Rprof file on rspatial/misc. This looks like an S4 oddity to
me. I can't see where the validity checks might recurse to trip calls to
other classes. The validity check ought to be a no-brainer, really. I
don't know when this happened, it may be caused by recent methods.
Any ideas?
Roger
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the Rspatial-devel
mailing list