Sunday, May 25, 2014

Week 1

It's now the end of the first week of coding, which I spent acquainting myself with the tools and code I'll be working with throughout the summer. I was unfortunately pretty busy this week because of classes, track practice, etc. so I didn't have too much time to program, but I managed to complete what I originally intended (I made sure to plan a light schedule for the first week).

My primary focus was on asv, a useful tool created by Michael Droettboom (an AstroPy developer) that can handle time and memory benchmarks for Git projects over a range of commits and nicely output the results on a static webserver. I experienced a bit of trouble getting asv to include certain dependencies (like Cython) when it creates virtual environments for Python, but once I got asv working smoothly, I made a small repo to test a few benchmarks. The results are visible here; the first commit is in pure Python, the second is the same code in Cython, and the third is Cython code slightly optimized via static typing. As I expected, performance improved considerably in Cython and even further with static typing (except for the looping function, since Cython automatically optimizes for loops with the exception of the statically typed loop counter).

I've also been playing around with line_profiler, although I've found that it won't work with Cython code; cProfile may be useful for profiling Cython code instead. cProfile only analyzes function performance, but I haven't seen a line-by-line profiler compatible with Cython and this shouldn't be a problem anyway. Of course, I'll still be using line_profiler to deal with pure Python code wherever it proves unnecessary to switch to Cython.

Next week I'll start writing benchmarks for the readers and writers in the astropy.io.ascii package using asv and line_profiler. My last day of classes is Tuesday, so after that I'll be able to work full time and really get into the swing of things.