[R] Odd timing behaviour in reading a file

Glenn Stone Glenn.Stone at csiro.au
Thu Aug 4 05:36:20 CEST 2005


Hi all,  please don't ask me why I tried this but.......

I have observed some odd behaviour in the time taken to read a file. I 
tried searching the archives without much success, but that could be me.

The first time I read a (60Mb) CSV file, takes a certain amount of time. 
The second time takes appreciably longer and the third and subsequent 
times very much shorter times. See below,

$ R2.1.1

R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.1.1  (2005-06-20), ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for a HTML browser interface to help.
Type 'q()' to quit R.

 > system.time(temp <- 
read.csv("Mapping50K_Xba240_annot.csv",header=TRUE, as.is=TRUE))
[1] 32.55  0.30 33.46  0.00  0.00
 > system.time(temp <- 
read.csv("Mapping50K_Xba240_annot.csv",header=TRUE, as.is=TRUE))
[1] 45.32  0.24 45.72  0.00  0.00
 > system.time(temp <- 
read.csv("Mapping50K_Xba240_annot.csv",header=TRUE, as.is=TRUE))
[1] 11.73  0.17 11.94  0.00  0.00
 > system.time(temp <- 
read.csv("Mapping50K_Xba240_annot.csv",header=TRUE, as.is=TRUE))
[1] 8.58 0.28 8.96 0.00 0.00
 > system.time(temp <- 
read.csv("Mapping50K_Xba240_annot.csv",header=TRUE, as.is=TRUE))
[1] 8.80 0.16 9.02 0.00 0.00


This is a relatively quiet opteron running redhat linux and using R2.1.1
The same pattern is repeatable, and occurs in R2.0.1 and on a Dell 
laptop running Windows XP.

I guess it is probably something to do with the garbage collector? Can 
anyone explain further? Particularly the first increase.

Thanks....

-- 
Glenn Stone
CSIRO Bioinformatics
http://www.bioinformatics.csiro.au




More information about the R-help mailing list