Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.8%) to scientific vocabulary
Keywords
compiler
fast
gcc
hpc
optimization
optimizer
r
Last synced: 6 months ago
·
JSON representation
Repository
Package: The R Code Optimizer
Basic Info
- Host: GitHub
- Owner: jcrodriguez1989
- Language: R
- Default Branch: master
- Homepage: https://jcrodriguez1989.github.io/rco/
- Size: 4.17 MB
Statistics
- Stars: 81
- Watchers: 2
- Forks: 20
- Open Issues: 22
- Releases: 0
Topics
compiler
fast
gcc
hpc
optimization
optimizer
r
Created almost 7 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Contributing
Code of conduct
README.Rmd
---
output: github_document
---
# rco - The R Code Optimizer
[](https://CRAN.R-project.org/package=rco)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://travis-ci.org/jcrodriguez1989/rco)
[](https://ci.appveyor.com/project/jcrodriguez1989/rco)
[](https://codecov.io/github/jcrodriguez1989/rco?branch=master)
Make your R code run faster!
`rco` analyzes your code and applies different optimization strategies that return an R code that runs faster.
The `rco` project, from its start to version 1.0.0, was made possible by a [Google Summer of Code 2019 project](https://summerofcode.withgoogle.com/archive/2019/projects/6300906386096128/).
Thanks to the kind mentorship of [Dr. Yihui Xie](https://yihui.org/en/) and [Dr. Nicolás Wolovick](https://cs.famaf.unc.edu.ar/~nicolasw/).
```{r echo=FALSE}
library("rco")
site_url <- "https://github.com/jcrodriguez1989/rco/blob/master/"
```
## Installation
Install the current released version of `rco` from [CRAN](https://cran.r-project.org/package=rco):
```{r eval = FALSE}
install.packages("rco")
```
Or install the development version from GitHub:
```
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github("jcrodriguez1989/rco", dependencies = TRUE)
```
## Usage
`rco` can be used in three ways:
* Using the RStudio Addins
1. `Optimize active file`: Optimizes the file currently open in RStudio. It will apply the optimizers present in `all_optimizers`.
2. `Optimize selection`: Optimizes the code currently highlighted in the RStudio Source Pane. It will apply the optimizers present in `all_optimizers`.
* Using the `shiny` GUIs
1. `rco_gui("code_optimizer")` opens a `shiny` interface in a browser. This GUI allows to easily optimize chunks of code.
2. `rco_gui("pkg_optimizer")` opens a `shiny` interface in a browser. This GUI allows to easily optimize R packages that are hosted at CRAN or GitHub.
* Using the R functions
1. Optimize some `.R` code files
```{r eval = FALSE}
optimize_files(c("file_to_optimize_1.R", "file_to_optimize_2.R"))
```
2. Optimize some code in a character vector
```{r eval = FALSE}
code <- paste(
"code_to_optimize <- 8 ^ 8 * 1918",
"cto <- code_to_optimize * 2",
sep = "\n"
)
optimize_text(code)
```
3. Optimize all `.R` code files into a folder
```{r eval = FALSE}
optimize_folder("~/myfolder_to_optimize", recursive = FALSE)
```
## Example
Suppose we have the following code:
```{r}
code <- paste(
"# I want to know my age in seconds!",
"years_old <- 29",
"days_old <- 365 * years_old # leap years don't exist",
"hours_old <- 24 * days_old",
"seconds_old <- 60 * 60 * hours_old",
"",
"if (seconds_old > 10e6) {",
' print("Whoa! More than a million seconds old, what a wise man!")',
"} else {",
' print("Meh!")',
"}",
sep = "\n"
)
```
We can automatically optimize it by doing:
```{r}
opt_code <- optimize_text(code, iterations = 1)
```
```{r echo = FALSE}
cat(opt_code)
```
After one optimization pass we can see that it has only propagated the `years_old` variable. Another pass:
```{r}
opt_code <- optimize_text(opt_code, iterations = 1)
```
```{r echo = FALSE}
cat(opt_code)
```
Now, it has folded the `days_old` variable, and then propagated it. Another pass:
```{r}
opt_code <- optimize_text(opt_code, iterations = 1)
```
```{r echo = FALSE}
cat(opt_code)
```
It has folded the `hours_old` variable, and then propagated it. Another pass:
```{r}
opt_code <- optimize_text(opt_code, iterations = 1)
```
```{r echo = FALSE}
cat(opt_code)
```
It has folded the `seconds_old` variable, and then propagated it into the `if` condition. Another pass:
```{r}
opt_code <- optimize_text(opt_code, iterations = 1)
```
```{r echo = FALSE}
cat(opt_code)
```
Now, it has folded the `if` condition, and as it was `TRUE` it just kept its body, as testing the condition or the `else` clause were dead code.
So, `optimize_text` function has automatically detected constant variables, constant foldable operations, and dead code. And returned an optimized R code.
## Guidelines for contributing
`rco` is an open source package, and the contributions to the development of the library are more than welcome. Please see our [CONTRIBUTING.md](`r paste0(site_url, ".github/CONTRIBUTING.md")`) file and ["Contributing an Optimizer"](https://jcrodriguez1989.github.io/rco/articles/contributing-an-optimizer.html) article for detailed guidelines of how to contribute.
## Code of Conduct
Please note that the 'rco' project is released with a [Contributor Code of Conduct](`r paste0(site_url, "CODE_OF_CONDUCT.md")`).
By contributing to this project, you agree to abide by its terms.
Owner
- Name: Juan C Rodriguez
- Login: jcrodriguez1989
- Kind: user
- Location: Cordoba, Argentina
- Company: FAMAF - UNC
- Website: https://jcrodriguez.rbind.io/
- Twitter: CancuCS
- Repositories: 7
- Profile: https://github.com/jcrodriguez1989
PhD in Computer Science
GitHub Events
Total
- Push event: 2
- Pull request event: 2
- Fork event: 1
Last Year
- Push event: 2
- Pull request event: 2
- Fork event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 249
- Total Committers: 4
- Avg Commits per committer: 62.25
- Development Distribution Score (DDS): 0.072
Top Committers
| Name | Commits | |
|---|---|---|
| Juan Cruz Rodriguez | j****z@b****r | 231 |
| Juan Cruz Rodriguez | j****z@u****r | 16 |
| Pachamaltese | m****s@d****l | 1 |
| Juan Cruz Rodriguez | j****z@w****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 13
- Total pull requests: 88
- Average time to close issues: about 2 months
- Average time to close pull requests: 5 months
- Total issue authors: 7
- Total pull request authors: 18
- Average comments per issue: 1.69
- Average comments per pull request: 0.81
- Merged pull requests: 17
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 1 day
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jcrodriguez1989 (4)
- ColinFay (3)
- udaydatar7 (2)
- adtserapio (1)
- olifog (1)
- XDPROAADARSH (1)
- ZeroDawn0D (1)
Pull Request Authors
- saxenism (26)
- pratishrai (15)
- ZeroDawn0D (8)
- udaydatar7 (8)
- adtserapio (7)
- Jack-horwell (5)
- hxxr (3)
- vansh0901 (3)
- seristof (2)
- Rishi0812 (2)
- adamhsparks (2)
- jcrodriguez1989 (2)
- olifog (1)
- ghost (1)
- Azamlynny (1)
Top Labels
Issue Labels
enhancement (4)
bug (3)
hacktoberfest (2)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 220 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: rco
The R Code Optimizer
- Homepage: https://jcrodriguez1989.github.io/rco/
- Documentation: http://cran.r-project.org/web/packages/rco/rco.pdf
- License: GPL-3
-
Latest release: 1.0.2
published almost 5 years ago
Rankings
Forks count: 4.1%
Stargazers count: 4.7%
Average: 28.5%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 68.4%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.6.0 depends
- covr * suggests
- diffr * suggests
- ggplot2 * suggests
- httr * suggests
- knitr * suggests
- markdown * suggests
- microbenchmark * suggests
- rmarkdown * suggests
- rstudioapi * suggests
- rvest * suggests
- shiny * suggests
- shinythemes * suggests
- testthat * suggests
- xml2 * suggests