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

Use integer literals and avoid coercions where needed #994

Merged
merged 6 commits into from
Sep 13, 2022
Merged

Use integer literals and avoid coercions where needed #994

merged 6 commits into from
Sep 13, 2022

Conversation

IndrajeetPatil
Copy link
Collaborator

@IndrajeetPatil IndrajeetPatil commented Sep 12, 2022

  • Use integer literals and avoid coercions where needed
  • Following our coding standards

As mentioned here:

### Control Flow

* Conditional statements should always evaluate to `TRUE` or `FALSE`, i.e. we 
  don't encourage `if (length(x))` but rather `if (length(x) > 0L)`.
* We avoid loops whenever possible and use functions like `purrr::map()` and 
  friends when possible and prefer them over R base counterparts like 
  `base::lapply()`.

@IndrajeetPatil IndrajeetPatil marked this pull request as ready for review September 12, 2022 13:34
R/compat-dplyr.R Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2022

Codecov Report

Merging #994 (902f9d5) into main (86ae9cf) will increase coverage by 0.11%.
The diff coverage is 94.28%.

@@            Coverage Diff             @@
##             main     #994      +/-   ##
==========================================
+ Coverage   90.23%   90.34%   +0.11%     
==========================================
  Files          47       47              
  Lines        2694     2694              
==========================================
+ Hits         2431     2434       +3     
+ Misses        263      260       -3     
Impacted Files Coverage Δ
R/addins.R 14.28% <0.00%> (ø)
R/compat-dplyr.R 92.85% <ø> (+7.14%) ⬆️
R/token-define.R 66.66% <0.00%> (ø)
R/ui-styling.R 100.00% <ø> (ø)
R/utils-cache.R 100.00% <ø> (ø)
R/relevel.R 47.82% <66.66%> (ø)
R/testing.R 68.61% <66.66%> (ø)
R/unindent.R 95.83% <85.71%> (ø)
R/detect-alignment-utils.R 97.22% <100.00%> (ø)
R/detect-alignment.R 97.75% <100.00%> (ø)
... and 21 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions

This comment was marked as outdated.

Copy link
Collaborator

@lorenzwalthert lorenzwalthert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow thanks @IndrajeetPatil for that hard work. Will review in detail later

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if f8644ab is merged into main:

  •   :ballot_box_with_check:cache_applying: 26.8ms -> 26.9ms [-1.74%, +2.82%]
  •   :ballot_box_with_check:cache_recording: 1.3s -> 1.3s [-1.06%, +1.46%]
  • ❗🐌without_cache: 3.4s -> 3.47s [+0.03%, +3.82%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 2569a3a is merged into main:

  •   :ballot_box_with_check:cache_applying: 41ms -> 41.5ms [-1.86%, +4.15%]
  •   :ballot_box_with_check:cache_recording: 2.07s -> 2.06s [-1.31%, +0.48%]
  •   :ballot_box_with_check:without_cache: 5.59s -> 5.6s [-0.33%, +0.61%]

Further explanation regarding interpretation and methodology can be found in the documentation.

Copy link
Collaborator

@lorenzwalthert lorenzwalthert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing to add. Just a thank you.

@lorenzwalthert lorenzwalthert changed the title Sundry of minor code improvements Use integer literals and avoid coercions where needed Sep 13, 2022
@IndrajeetPatil IndrajeetPatil merged commit 4398297 into r-lib:main Sep 13, 2022
@IndrajeetPatil IndrajeetPatil deleted the avoid_apply_for branch September 13, 2022 19:17
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.

3 participants