Are you creating a bunch of garbage? My understanding is that any garbage that gets created will be cleaned up at seemingly haphazard (but fully deterministic) points in times.
-- John On Dec 11, 2014, at 11:43 PM, Sean McBane <[email protected]> wrote: > Hi all, > > So, I'm starting to define a couple of routines to be used in iterative > solvers, optimized for sparse matrices. I wrote a routine that returns me a > list of tuples containing the (i,j) coordinates for the non-zero values from > a sparse matrix and was testing it for timing, but observed a performance > issue I don't understand. > > Testing using a 1000000x1000000 sparse matrix from a sample finite difference > problem, containing about 5000000 non-zero values, @time shows a time of ~20s > the first time I load the module and execute the function, and about 3-5% of > that is gc. I'm sure I can speed that up later, but the really odd thing is > that the NEXT run, it takes ~40s and about 50% of that is garbage collection. > The next one after that is back to 20s, and it keeps going back and forth > every time. This seems really weird to me. > > Anyway, to confirm that I wasn't going crazy I wrote a loop and timed this a > hundred times and collected results, and it keeps following the same pattern. > See attached 'times.txt' with the numbers. Any ideas what could be causing > this behavior? > > Thanks, > > -- Sean
