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

Refactor: extract peer list in torrent repository entry #797

Merged
merged 4 commits into from
Apr 16, 2024

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Apr 15, 2024

This PR extracts a new type, "PeerList", used in the torrent repository entry.

Why

  • It can be tested independently (unit tests and benchmarking).
  • Other implementations could be added in the future. This abstraction hides implementation details (the collection used).

Performance

It looks like it does not affect the performance.

Requests out: 406025.97/second
Responses in: 365423.41/second
  - Connect responses:  180950.24
  - Announce responses: 180818.87
  - Scrape responses:   3654.30
  - Error responses:    0.00
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 104
  - p99.9: 295
  - p100: 367

Extract a type for a collection of peers.

The performance adter the exatract is similar:

```output
Requests out: 415067.21/second
Responses in: 369397.08/second
  - Connect responses:  183049.81
  - Announce responses: 182717.15
  - Scrape responses:   3630.12
  - Error responses:    0.00
Peers per announce response: 0.00
Announce responses per info hash:
  - p10: 1
  - p25: 1
  - p50: 1
  - p75: 1
  - p90: 2
  - p95: 3
  - p99: 104
  - p99.9: 297
  - p100: 375
```
@josecelano josecelano requested a review from da2ce7 April 15, 2024 17:01
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label Apr 15, 2024
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.55%. Comparing base (52b7e3a) to head (40182b4).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #797      +/-   ##
===========================================
+ Coverage    78.15%   78.55%   +0.40%     
===========================================
  Files          159      160       +1     
  Lines         8857     9024     +167     
===========================================
+ Hits          6922     7089     +167     
  Misses        1935     1935              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano
Copy link
Member Author

ACK 40182b4

@josecelano josecelano marked this pull request as ready for review April 16, 2024 11:01
@josecelano josecelano added this to the v3.0.0 milestone Apr 16, 2024
@josecelano josecelano merged commit 7664ec6 into torrust:develop Apr 16, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup / Refactoring Tidying and Making Neat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant