measure time execution of function counting string