As a note, the amount of memory allocated in both cases is the same. The difference seems to be only caused by garbage collection.
On Thursday, December 11, 2014 10:43:03 PM UTC-6, Sean McBane 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 >
