FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

avoid need for R_NilValue checks in protect code by kevinushey · Pull Request #285 · r-lib/cpp11 · GitHub

/ cpp11 Public

avoid need for R_NilValue checks in protect code - #285

Merged
romainfrancois merged 8 commits into
r-lib:mainfrom
kevinushey:feature/protect-null-checks
May 17, 2023
Merged

romainfrancois merged 8 commits into
r-lib:mainfrom
kevinushey:feature/protect-null-checks

Conversation

kevinushey commented Sep 17, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor

This PR provides a minor optimization, that allows us to avoid the need to check the tail in the precious list for R_NilValue. This is done by ensuring that the "tail" of the precious list is itself initialized as a "cell", and so one can always safely access its CAR.

The only downside is that the "empty" precious list now has two cells rather than one, but it should be worth the bit of extra performance (+ the overall code clarity is IMHO improved).

Copy link
Copy Markdown
Collaborator

Thanks !

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL