However, the first execution of the function will still suffer from the same problems in terms of execution time, which will prevent you from getting an accurate measurement of timing.
You will end up with some data reflecting not necessarily the execution time but rather the result of OS code running optimization, which again will affect your averaging.