(This article was first published on macsci, and kindly contributed to R-bloggers)

For instance:
> performance(complex.function(1,5,"goal"), samples=100)
Average time per run:
-----------------------------
User System Elapsed
0.338 0.014 0.352
Total time for all runs:
------------------------
User System Elapsed
33.805 1.369 35.212
I included 'performance' in my R basic functions (see also Customizing R: startup script).
To leave a comment for the author, please follow the link and comment on his blog: macsci.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).