Created attachment 1718 [details]
topenv is a base function called frequently by methods and is one of the slower "self" functions when profiling package loading. I have attached a C version that will generally be useful and saves a bit of time during package loading.
Created attachment 1719 [details]
diffs to https://svn.r-project.org/R/trunk, revision 67349
Created attachment 1724 [details]
diffs to https://svn.r-project.org/R/trunk revision 67477
C version of topenv, defaults can now be handled at the C level.
Thank you, Peter.
(the patch was somehow not good, in the sense I could not use 'patch < ..' with it.)
I've committed (basically) this to R-devel - rev 67524.
One issue is thinking about a faster getOption(). In your patch you had replaced it by options(..) as that is indeed the current R implementation.
Rather I thinking we should expose R's C-level getOption().