pdfTeX, provides two macros that can be used to determine the time elapsed from a run start. The first one determines the elapsed time in "scaled seconds", that means seconds divided by 65536.
\pdfelapsedtime
and the second one \pdfresettimer that resets the internal timer back to 0.
I got curious and ran the following code:
\documentclass{article}
\usepackage{fp,siunitx,ifthen}
\def\startTimer{\pdfresettimer}
\def\stopTimer{%
\the\pdfelapsedtime\,scaled seconds
\FPdiv\result{\the\pdfelapsedtime}{65536}
\FPmul\result{\result}{1000000} %microseconds
\FPround\result{\result}{6}\par
\result \si{\milli\second}\par}
\begin{document}
\startTimer
\newcount\n
\n=0
\loop%
\advance\n by1
\number\n, %
\ifnum\n<888%
\repeat% 3-4 scaled points
%% ifthen code
\newcounter{acount}
\whiledo{\value{acount}<888}{%
\stepcounter{acount}%
\theacount, } %5-6 scaled points average
\stopTimer
\end{document}
My question is: Is this a good way to measure the efficiency of the loops? Are there any other ways? Can you please post your run times and your machine for comparison?
My results: "loop"
and "whiledo" 
\loop...\repeatis that you are using\texttt, rather than\theacount. The former needs quite a few expansions, whereas the latter is just one "very simple" expansion. – Bruno Le Floch Jan 16 '11 at 17:59textttwhich I realized and edited the answer probably due to the loading of fonts? I run the code twice with the macros commented accordingly. – yannisl Jan 16 '11 at 18:08\stopTimerand\startTimerbetween the two loops works. --- I get a similar result as Caramdir (factor of ~40 between the two). – Bruno Le Floch Jan 16 '11 at 18:17