Closed Moohan closed 4 years ago
Looks good, much faster! I had made a small change to this function as well after a suggestion from @alan-y to give more useful output when CHI is missing (currently returns as "invalid character") see #39. It hasn't been approved/merged yet so we might need to figure out the best way to incorporate both?
I think I checked and there weren't any merge conflicts but I guess the best way to do it is to have yours approved and merged first, then either merge mine or make any changes to make it work before merging.
Changes can be made without losing any functionality to increase the speed of the CHI functions
chi_check
andchi_pad
. The speedup is useful, particularly when running against a large number of CHIs.I've already created a branch
chi-speed-up
. Below are the improvements when running on this list of CHIs (used in the tests)chis <- c("0101011237", "0101201234", "3201201234", "0113201234", "3213201234", "123456789", "12345678900", "010120123?", "1904851231")
A roughly 10X speedup overall on the
chi_check
function:check_bm <- microbenchmark::microbenchmark( check_old = chi_check(chis), check_new = chi_check_new(chis), check = "identical", times = 1000 )
check_bm
ggplot2::autoplot(check_bm)
And a >2X speedup for
chi_pad
:pad_bm <- microbenchmark::microbenchmark( pad_old = chi_pad(chis), pad_new = chi_pad_new(chis), check = "identical", times = 1000 )
pad_bm
ggplot2::autoplot(pad_bm)