33
44# quickr <img src =" man/figures/logo.png " align =" right " height =" 138 " />
55
6- <!-- <img
7- src="https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExMjBhNWt1Z3Q4ZW56cG00c2hncmtwbGJycm53M3JxYWdscjRkaDJobCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/12haGO61oFZ28w/giphy.gif"
8- alt="An animated GIF showing two characters in a spaceship cockpit rapidly accelerating into hyperspace, with stars stretching into bright streaks, creating a sensation of rapid acceleration and motion." /> -->
6+ <!-- {alt="An animated GIF showing two characters in a spaceship cockpit rapidly accelerating into hyperspace, with stars stretching into bright streaks, creating a sensation of rapid acceleration and motion."} -->
97
108<!-- badges: start -->
119
10+ [ ![ R-CMD-check] ( https://github.com/t-kalinowski/quickr/actions/workflows/R-CMD-check.yaml/badge.svg )] ( https://github.com/t-kalinowski/quickr/actions/workflows/R-CMD-check.yaml )
1211<!-- badges: end -->
1312
1413The goal of quickr is to make your R code run quicker.
@@ -20,11 +19,11 @@ and dynamicism can come at the expense of speed. This package lets you
2019trade back some of that flexibility for some speed, for the context of a
2120single function.
2221
23- <!-- Programming language design requires some hard decisions and trade-offs . -->
22+ <!-- Programming language design requires some hard decisions and trade-ofs . -->
2423
2524<!-- When you want to have it all, you typically end up have two (or more!) languages. -->
2625
27- <!-- An interpreted, dynamic language full of conveniences, and a statically‑ typed, explicit, high-performance language. -->
26+ <!-- An interpreted, dynamic language full of conveniences, and a staticly- typed, explicit, high-performance language. -->
2827
2928<!-- This is sometimes called the "Two Language Problem". -->
3029
@@ -138,9 +137,9 @@ timings
138137# > # A tibble: 3 × 6
139138# > expression min median `itr/sec` mem_alloc `gc/sec`
140139# > <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
141- # > 1 r 1.05s 1.05s 0.955 847KB 0.955
142- # > 2 quickr 4.8ms 5.09ms 195 . 782KB 3.07
143- # > 3 c 4.73ms 5.04ms 196 . 782KB 3.09
140+ # > 1 r 1.04s 1.04s 0.957 782KB 0.957
141+ # > 2 quickr 4.85ms 5.03ms 198 . 782KB 3.61
142+ # > 3 c 4.88ms 5.06ms 197 . 782KB 4.13
144143plot(timings ) + bench :: scale_x_bench_time(base = NULL )
145144```
146145
@@ -163,16 +162,17 @@ In the case of `convolve()`, `quick()` returns a function approximately
163162
164163<!-- -->
165164
166- #> [1] - : != ( [ [<- {
167- #> [8] * / & && %/% %% ^
168- #> [15] + < <- <= = == >
169- #> [22] >= | || Arg Conj Fortran Im
170- #> [29] Mod Re abs acos asin atan c
171- #> [36] cat cbind ceiling character cos declare double
172- #> [43] exp floor for if ifelse integer length
173- #> [50] log log10 logical matrix max min numeric
174- #> [57] print prod raw seq sin sqrt sum
175- #> [64] tan which.max which.min
165+ #> [1] - : != ( [ [<- {
166+ #> [8] * / & && %/% %% ^
167+ #> [15] + < <- <= = == >
168+ #> [22] >= | || Arg Conj Fortran Im
169+ #> [29] Mod Re abs acos as.double asin atan
170+ #> [36] break c cat cbind ceiling character cos
171+ #> [43] declare dim double exp floor for if
172+ #> [50] ifelse integer length log log10 logical matrix
173+ #> [57] max min ncol next nrow numeric print
174+ #> [64] prod raw repeat runif seq sin sqrt
175+ #> [71] sum tan which.max which.min while
176176
177177Many of these restrictions are expected to be relaxed as the project
178178matures. However, quickr is intended primarily for high-performance
@@ -281,8 +281,8 @@ timings
281281# > # A tibble: 2 × 6
282282# > expression min median `itr/sec` mem_alloc `gc/sec`
283283# > <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
284- # > 1 slow_viterbi 143.04µs 162µs 6047 . 178KB 14.5
285- # > 2 quick_viterbi 2.43µs 2.53µs 368609 . 0B 0
284+ # > 1 slow_viterbi 147.12µs 162.33µs 5957 . 1.59KB 16.8
285+ # > 2 quick_viterbi 2.48µs 2.62µs 367468 . 0B 0
286286plot(timings )
287287```
288288
@@ -360,8 +360,8 @@ summary(timings, relative = TRUE)
360360# > # A tibble: 2 × 6
361361# > expression min median `itr/sec` mem_alloc `gc/sec`
362362# > <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl>
363- # > 1 diffuse_heat 127 . 122 . 1 1014 . Inf
364- # > 2 quick_diffuse_heat 1 1 121 . 1 NaN
363+ # > 1 diffuse_heat 131 . 127 . 1 1011 . Inf
364+ # > 2 quick_diffuse_heat 1 1 127 . 1 NaN
365365plot(timings )
366366```
367367
@@ -407,9 +407,9 @@ timings
407407# > # A tibble: 3 × 6
408408# > expression min median `itr/sec` mem_alloc `gc/sec`
409409# > <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
410- # > 1 r 105.4ms 109.13ms 7.42 124.31MB 22.3
411- # > 2 rcpp 19.7ms 19.84ms 49.4 4.44MB 1.98
412- # > 3 quickr 7ms 7.09ms 138 . 781.35KB 2.00
410+ # > 1 r 114.2ms 132.75ms 5.66 124.24MB 9.44
411+ # > 2 rcpp 19.35ms 19.58ms 50.9 4.44MB 0
412+ # > 3 quickr 6.73ms 6.87ms 142 . 781.35KB 1.98
413413
414414timings $ expression <- factor (names(timings $ expression ), rev(names(timings $ expression )))
415415plot(timings ) + bench :: scale_x_bench_time(base = NULL )
@@ -424,6 +424,13 @@ and place them in the `./src` directory. Run `devtools::load_all()` or
424424` quickr::compile_package() ` to ensure that the generated files in
425425` ./src ` and ` ./R ` are in sync with each other.
426426
427+ In a package, you must provide a function name to ` quick() ` . For
428+ example:
429+
430+ ``` r
431+ my_fun <- quick(name = " my_fun" , function (x ) ... . )
432+ ```
433+
427434## Installation
428435
429436You can install quickr from CRAN with:
0 commit comments