-
Notifications
You must be signed in to change notification settings - Fork 6
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
Refactor and NA handling for 'decode()' #35
Conversation
The second commit contains edits to the Rcpp code related to
BenchmarksTest below is very simplistic and not robust, but the code edits yield a ~250x speed up. library(googlePolylines)
library(microbenchmark)
# Create vector of 2000 polylines
polylines <- c(
"ohlbDnbmhN~suq@am{tAw`qsAeyhGvkz`@fge}A",
"ggmnDt}wmLgc`DesuQvvrLofdDorqGtzzV"
)
polylines <- rep(polylines, 1000) Original code microbenchmark::microbenchmark(
decode(polylines),
times = 10
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
#> decode(polylines) 473.4338 492.1889 497.8863 497.521 506.2926 517.1034 10 Updated code microbenchmark::microbenchmark(
decode(polylines),
times = 100
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
#> decode(polylines) 1.797718 1.868518 2.149002 1.921164 2.084554 5.080253 100 |
great work @ChrisMuir , I'll review in the coming days, but it all looks good. |
👍 Cool sounds good. If you have any comments/questions, just let me know, I'm happy to make additional edits or tweaks to edits in my commits. |
@ChrisMuir everything looks good - merged into master |
The first commit is in reference to issue #34, initial commit to allow
decode()
to handleNA
input. Also added a test totest-Decode.R
.Previous code:
Updated code:
For the
encode()
cases from issue #34, I'm happy to contribute PR's for them as well. I just really don't know enough about howmapdeck
usesgooglePolylines::encode()
to suggest a best solution though.