paws-r / paws

Paws, a package for Amazon Web Services in R
https://www.paws-r-sdk.com
Other
305 stars 37 forks source link

convert components of resolver_endpoint to cpp #756

Closed DyfanJones closed 4 months ago

DyfanJones commented 4 months ago

Initially started out as away to improve my cpp knowledge. This developed into performance enhancements for resolve_endpoint function.

endpoints <- list("us-gov-west-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "us-west-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "us-west-2" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "eu-west-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "ap-southeast-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "ap-southeast-2" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "ap-northeast-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "sa-east-1" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "us-east-1" = list(endpoint = "s3.amazonaws.com", global = FALSE), "*" = list(endpoint = "s3.{region}.amazonaws.com", global = FALSE), "cn-*" = list(endpoint = "s3.{region}.amazonaws.com.cn", global = FALSE), "us-iso-*" = list(endpoint = "s3.{region}.c2s.ic.gov", global = FALSE), "us-isob-*" = list(endpoint = "s3.{region}.sc2s.sgov.gov", global = FALSE))
service <- "s3"
region <- "us-east-1"

(bm <- bench::mark(
  paws_v0.7.0 = resolver_endpoint(service, region, endpoints),
  paws_v0.7.0.9000 = paws.common:::resolver_endpoint(service, region, endpoints)
))
#> # A tibble: 2 × 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 old_paws     68.5µs   72.7µs    13285.    4.54MB     25.5
#> 2 new_paws     33.2µs   34.8µs    28270.    5.89MB     11.3

bm |> ggplot2::autoplot()
#> Loading required namespace: tidyr

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

DyfanJones commented 4 months ago

NOTE: this PR has initial revdepcheck results.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.23%. Comparing base (26709d5) to head (af823a1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #756 +/- ## ========================================== - Coverage 85.28% 85.23% -0.06% ========================================== Files 207 213 +6 Lines 15091 15193 +102 ========================================== + Hits 12871 12949 +78 - Misses 2220 2244 +24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.