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

GCD calculation #426

Open
dajmcdon opened this issue Mar 6, 2024 · 1 comment
Open

GCD calculation #426

dajmcdon opened this issue Mar 6, 2024 · 1 comment
Labels
question Further information is requested

Comments

@dajmcdon
Copy link
Contributor

dajmcdon commented Mar 6, 2024

I'm not entirely sure what the use case for gcd_num() is, but is it worth implementing differently? We don't currently import Rcpp (which the second version uses):

d <- sample(1:1000, 1000, TRUE)

microbenchmark::microbenchmark(
  epiprocess = epiprocess:::gcd_num(d),
  rtestim = rtestim:::gcd(d)
)
#> Warning in microbenchmark::microbenchmark(epiprocess = epiprocess:::gcd_num(d),
#> : less accurate nanosecond times to avoid potential integer overflows
#> Unit: microseconds
#>        expr       min         lq      mean    median       uq      max neval
#>  epiprocess 12249.816 12346.0635 17960.673 12423.984 14510.54 484596.5   100
#>     rtestim    19.024    24.2515  5672.601    34.973    51.66 563304.5   100

Created on 2024-03-06 with reprex v2.1.0

@dajmcdon dajmcdon added the question Further information is requested label Mar 6, 2024
@dsweber2
Copy link
Contributor

dsweber2 commented Mar 6, 2024

That mean median comparison though.

When I search for gcd_num, the only time it shows up is in guess_period, where it is handed a list of diffs between dates, converted to numeric. So I'd expect it to run once per loop of epix_process, which doesn't seem likely to eat too much time.

The lack of tests may mean there's a bug lurking, so that would be a potential gain from switching over to a non-DIY implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants