Updates timeit function for memory management and io.

Adds the changes we were thinking about. This does not compile yet.