Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove #define USE_RINTERNALS #3301

Closed
12 tasks done
mattdowle opened this issue Jan 22, 2019 · 2 comments · Fixed by #4164
Closed
12 tasks done

Remove #define USE_RINTERNALS #3301

mattdowle opened this issue Jan 22, 2019 · 2 comments · Fixed by #4164
Milestone

Comments

@mattdowle
Copy link
Member

mattdowle commented Jan 22, 2019

With ALTREP in R 3.5+ it's no longer true that defining USE_RINTERNALS before including Rinternals.h makes REAL(), INTEGER() etc into macros. That's why I did it originally and it's no longer true, so there's no point in doing it anymore. It was good advice because it was a lot faster. The new advice with R 3.5+ is to not use the R API inside loops.
See also: #2866 (comment) and #3188 (comment)

Section 5.14 of R-exts manual contains :

If efficiency is essential, the internal versions of the accessors can be obtained by defining ‘USE_RINTERNALS’ before including Rinternals.h. If you find it necessary to do so, please do test that your code compiles without ‘USE_RINTERNALS’ defined, as this provides a stricter test that the accessors have been used correctly. Also be prepared to adjust your code should R internals change.
The accessor functions, and other functions in the R API, are also subject to change to support the ‘ALTREP’ project (https://svn.r-project.org/R/branches/ALTREP/ALTREP.html). Code that does not define ‘USE_RINTERNALS’ should not be affected by these changes, but code that does define ‘USE_RINTERNALS’ may need to be adjusted.

I've tried turning off USE_RINTERNALS and data.table compiles and passes all tests with latest versions of R because DATAPTR is exposed in the R API. But still we're not supposed to use it. Not passing R 3.1.0 until DATAPTR is removed (72 22 calls) :

@jangorecki
Copy link
Member

jangorecki commented Feb 4, 2019

Code from quickselect.c is not being used anywhere, I suggest to remove that file. It is being unnecessarily compiled on each installation. If we will remove it nicely in separate commit, separate PR, we can always easily find it later on if needed.

jangorecki added a commit that referenced this issue Feb 4, 2019
@mattdowle
Copy link
Member Author

@jangorecki dquickselect and iquickselect in quickselect.c are being used in gsumm.c. But the single use of DATAPTR in it is commented out, so that part can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants