time measurements + performance improvements