Displaying 20 results from an estimated 3000 matches similar to: "standardGeneric seems slow; any way to get around it?"
2007 Aug 23
2
read big text file into R
Dear Rs:
Hi, I am trying to read a big text file (nrows=243440, ncols=144). It  
seems the computational time of all the read methods 
(scan,readtable,read.delim) is not linear to the number of rows I  
want to read in: things became really slow once I tried to read in  
100000 lines compare to 10000 lines).
If I am reading the profiling result right, I guess scan wouldn't  
help either.
My
2007 Mar 31
1
Probem with argument "append" in "Rprof"
Hello,
Appending information to the profiler's output seems to generate
problems. Here is a small example of code :
<code r>
require(boot)
Rprof( memory.profiling = TRUE)
Rprof(NULL)
for(i in 1:2){
  Rprof( memory.profiling = TRUE, append = TRUE)
  example(boot)
  Rprof(NULL)
}
</code>
The problem is that the file Rprof.out contains more than once the
header information:
$ grep
2004 Jul 16
3
interpreting profiling output
I have some trouble interpreting the output from profiling. I have
read the help pages Rprof, summaryRprof and consult the R extensions
manual, but I still have problems understanding the output.
Basically the output consist of self.time and total.time. I have the
understanding that total.time is the time spent in a given function
including any subcalls or child functions or whatever the
2009 Mar 03
1
profiler and loops
Hello,
(This is follow up from this thread: 
http://www.nabble.com/execution-time-of-.packages-td22304833.html but 
with a different focus)
I am often confused by the result of the profiler, when a loop is 
involved. Consider these two scripts:
script1:
Rprof( )
x <- numeric( )
   for( i in 1:10000){
     x <- c( x, rnorm(10) )
   }
Rprof( NULL )
print( summaryRprof( ) )
script2:
2013 Apr 05
2
line profiling
Hello,
This is about the new "line profiling" feature in R 3.0.0. As I was
testing it, I find the results somewhat disappointing so I'd like to
get your opinion.
I put some poorly written code in a test.R file, here are the contents:
double <- function(x) {
  out <- c()
  for (i in x) {
    out <- c(out, 2*i)   # line 4
  }
  return(out)
}
Then this how I source the file
2009 Jun 12
1
Rprof loses all system() time
Rprof seems to ignore all time spent inside system() calls.  E.g.,
this simple example actually takes about 10 seconds, but Rprof thinks
the total time is only 0.12 seconds:
> Rprof("sleep-system.out") ; system.time(system(command="sleep 10")) ; Rprof(NULL)
   user  system elapsed
  0.000   0.004  10.015
> summaryRprof("sleep-system.out")$by.total
             
2009 Oct 19
2
how to get rid of 2 for-loops and optimize runtime
Short: get rid of the loops I use and optimize runtime
Dear all,
I want to calculate for each row the amount of the month ago. I use a matrix with 2100 rows and 22 colums (which is still a very small matrix. nrows of other matrixes can easily be more then 100000)
Table before
Year  month quarter yearmonth Service ...  Amount
2009  9        Q3            092009          A                ...   
2007 Oct 22
2
Help interpreting output of Rprof
Hello there,
I am not quite sure how to interpret the output of Rprof (in the following the output I was staring at). I was poking around the web a little bit for documentation but without much success. I guess if I want to figure out what takes so long in my code the 2nd table $by.total and the total.pct column (pct = percent) is the most helpful. What does it mean that [ or [.data.frame is
2004 Oct 16
3
Lazy loading... advices
Hello,
I am looking for more information about lazy loading introduced in R 2.0.0.
Doing
?lazyLoad
I got some and there is a 'see also' section that points to
'makeLazyLoading'... But I cannot reach this page.
My problem is: I recompiled a library that uses a lot of functions from
other libraries (of course I can give details if needed). I load it in my
computer: library(svGUI),
2012 Oct 26
1
Parsing very large xml datafiles with SAX: How to profile <anonymous> functions?
Hello everyone,
I'm trying to parse a very large XML file using SAX with the XML package
(i.e., mainly the xmlEventParsing function). This function takes as an
argument a list of other functions (handlers) that will be called to handle
particular xml nodes.
If when I use Rprof(), all the handler functions are lumped together under
the <anonymous> label, and I get something like this:
2005 Oct 25
1
performance of nchar
Hi,
    Is nchar function knowingly slow in R? I'm doing some string 
formatting that requires multiple call to nchar, and nchar seems to be 
very slow.
Experiment 1, pass nchar inside sprintf, and it takes 0.7 seconds
 > system.time(for (i in 1:10000)
+ str = sprintf('0005%020d', nchar(op))
+ )[3]
[1] 0.7
Experiment 2, get the length of op separately using nchar, and then pass 
2010 Nov 17
1
efficient conversion of matrix column rows to list elements
Hi List,
I'm hoping to get opinions for enhancing the efficiency of the following
code designed to take a vector of probabilities (outcomes) and calculate a
union of the probability space. As part of the union calculation, combn()
must be used, which returns a matrix, and the parallelized version of
lapply() provided in the multicore package requires a list. I've found that
2003 Nov 29
3
performance gap between R 1.7.1 and 1.8.0
Dear R-help,
A colleague of mine was running some code on two of our boxes, and noticed a
rather large difference in running time.  We've so far isolated the problem
to the difference between R 1.7.1 and 1.8.0, but not more than that.  The
exact same code took 933.5 seconds in 1.7.1, and 3594.4 seconds in 1.8.1, on
the same box.
Basically, the code calls boot() to bootstrap fitting mixture
2009 Mar 18
2
Profiling question: string formatting extremely slow
Hi all,
I'm using R to find duplicates in a set of 6 files containing Part Number
information. Before applying the intersect method to identify the duplicates
I need to normalize the P/Ns. Converting the P/N to uppercase if
alphanumerical and applying an 18 char long zero padding if numerical.
When I apply the pn_formatting function (see code below) to "Part Number"
column of the
2004 Oct 16
7
sapply and loop
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and 
define some function on this matrix to get a 6 dimension vector as my 
results.
As the loop should be slow, I generate 200 matrice first, and save them into 
a list named ma,
then I define zz<-sapply(ma, myfunction)
To my surprise, It almost costs me the same time to get my results if I 
directly use a loop
2004 Oct 16
7
sapply and loop
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and 
define some function on this matrix to get a 6 dimension vector as my 
results.
As the loop should be slow, I generate 200 matrice first, and save them into 
a list named ma,
then I define zz<-sapply(ma, myfunction)
To my surprise, It almost costs me the same time to get my results if I 
directly use a loop
2012 Dec 05
1
Understanding svd usage and its necessity in generalized inverse calculation
Dear R-devel:
I could use some advice about matrix calculations and steps that might
make for faster computation of generalized inverses. It appears in
some projects there is a bottleneck at the use of svd in calculation
of generalized inverses.
Here's some Rprof output I need to understand.
>   summaryRprof("Amelia.out")
$by.self
                             self.time self.pct
2016 Dec 08
3
wish list: generalized apply
Dear All,
I regularly want to "apply" some function to an array in a way that the arguments to the user function depend on the index on which the apply is working.  A simple example is:
A <- array( runif(160), dim=c(5,4,8) )
x <- matrix( runif(32), nrow=4, ncol=8 ) 
b <- runif(8)
f1 <- function( A, x, b ) { sum( A %*% x ) + b } 
result <- rep(0.0,8) 
for (i in 1:8) {
 
2011 Feb 11
1
Help optimizing EMD::extrema()
Hi folks,
I'm attempting to use the EMD package to analyze some neuroimaging
data (timeseries with 64 channels sampled across 1 million time points
within each of 20 people). I found that processing a single channel of
data using EMD::emd() took about 8 hours. Exploration using Rprof()
suggested that most of the compute time was spent in EMD::extrema().
Looking at the code for EMD:extrema(),
2012 Jun 09
3
More simple implementation is slow.
Hi all.
I'm developing a function, which must return a square matrix.
Here is the code:
http://pastebin.com/THzEW9N7
These functions implement an analog of two embedded for cycles.
The first variant creates the resulting matrix by columns, cbind()-ing them
one by one.
The second variant creates the matrix with two columns, which rows contain
all possible 
variants of i and j and calls apply