cleanup memory management
added macros for finer duration measurements and used them in all tests