sagebind / isahc

The practical HTTP client that is fun to use.
https://docs.rs/isahc
MIT License
705 stars 62 forks source link

refactor: Remove lifetime from Context, ResponseFuture, InterceptorFuture #405

Closed Xuanwo closed 1 year ago

Xuanwo commented 2 years ago

This PR will fix #403

The benchmark seems can't reflect the actual improvement. (I guess the test case(64K) is not suitable to measure the different between an Arc::new)

Before:

download 64K: isahc     time:   [201.80 ms 204.40 ms 207.00 ms]

After

download 64K: isahc     time:   [200.32 ms 203.57 ms 206.90 ms]
codecov[bot] commented 2 years ago

Codecov Report

Merging #405 (683bd9e) into master (352fbbc) will increase coverage by 0.14%. The diff coverage is 92.30%.

@@            Coverage Diff             @@
##           master     #405      +/-   ##
==========================================
+ Coverage   51.94%   52.09%   +0.14%     
==========================================
  Files          52       52              
  Lines        5796     5787       -9     
==========================================
+ Hits         3011     3015       +4     
+ Misses       2785     2772      -13     
Impacted Files Coverage Δ
src/interceptor/mod.rs 0.00% <0.00%> (ø)
src/request.rs 53.94% <ø> (ø)
src/lib.rs 16.51% <50.00%> (-0.09%) :arrow_down:
src/cookies/interceptor.rs 86.84% <94.44%> (+12.92%) :arrow_up:
src/client.rs 82.24% <97.22%> (-0.11%) :arrow_down:
src/default_headers.rs 100.00% <100.00%> (ø)
src/interceptor/context.rs 75.00% <100.00%> (ø)
src/interceptor/obj.rs 100.00% <100.00%> (ø)
src/redirect.rs 86.77% <100.00%> (+8.41%) :arrow_up:
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Xuanwo commented 2 years ago

Hi, @sagebind, can you take a look into this PR? Thanks!

Xuanwo commented 2 years ago

@sagebind I did some refactor on this PR, PTAL