Bug 16140 - speedup for topenv
Summary: speedup for topenv
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R 3.1.2
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-01-07 19:08 UTC by Peter Haverty
Modified: 2015-01-20 09:05 UTC (History)
1 user (show)

See Also:


Attachments
timing vignette (17.77 KB, text/html)
2015-01-07 19:08 UTC, Peter Haverty
Details
diffs to https://svn.r-project.org/R/trunk, revision 67349 (1.28 KB, application/x-gzip)
2015-01-07 19:09 UTC, Peter Haverty
Details
diffs to https://svn.r-project.org/R/trunk revision 67477 (1.27 KB, application/x-gzip)
2015-01-16 02:05 UTC, Peter Haverty
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Haverty 2015-01-07 19:08:52 UTC
Created attachment 1718 [details]
timing vignette

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.
Comment 1 Peter Haverty 2015-01-07 19:09:45 UTC
Created attachment 1719 [details]
diffs to https://svn.r-project.org/R/trunk, revision 67349
Comment 2 Peter Haverty 2015-01-16 02:05:17 UTC
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.
Comment 3 Martin Maechler 2015-01-19 10:19:34 UTC
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(..)[1] as that is indeed the current R implementation.
Rather I thinking we should expose R's C-level getOption().