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

Fix all cache #422

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Fix all cache #422

merged 4 commits into from
Oct 3, 2024

Conversation

shahronak47
Copy link
Contributor

@shahronak47 shahronak47 commented Oct 2, 2024

This PR aims at removing future and promises dependencies and other code related to it.

  1. Removes packages dependencies - future, promises , future.callr, future.apply
  2. Don't treat country = "all" and year = "all" differently
  3. Remove is_forked function which checks if the calculation is intensive and uses future and promise for those calls.
  4. Remove the endpoint /n-workers and it's associated tests.
  5. Add vignette with some information about caching debugging
  6. Added test to ensure that we have all the packages imported that we use in the file endpoints.R

@shahronak47
Copy link
Contributor Author

Checking the performance on DEV branch vs fix-all-cache branch

DEV branch performance

path1 <- "api/v1/pc-charts?country=all&year=all&povline=1.2&ppp_version=2017&fill_gaps=true"
path2 <- "api/v1/pip?country=all&year=all&povline=5&ppp_version=2017&fill_gaps=false"

tictoc::tic()
d <- httr::GET(local$root_url, 
               port = local$port, 
               path = path1) |> 
  httr::content(encoding = "UTF-8")
tictoc::toc()
61.26 sec elapsed

tictoc::tic()
d <- httr::GET(local$root_url, 
               port = local$port, 
               path = path2) |> 
  httr::content(encoding = "UTF-8")
tictoc::toc()
17.19 sec elapsed

fix-all-cache branch performance

tictoc::tic()
d <- httr::GET(local$root_url, 
               port = local$port, 
               path = path1) |> 
  httr::content(encoding = "UTF-8")
tictoc::toc()
58.28 sec elapsed

tictoc::tic()
d <- httr::GET(local$root_url, 
               port = local$port, 
               path = path2) |> 
  httr::content(encoding = "UTF-8")
tictoc::toc()
16.97 sec elapsed

@randrescastaneda randrescastaneda deleted the fix-all-cache branch October 3, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants