few scala functions to measure code performance