Skip to content

Conversation

josecelano
Copy link
Member

Relates to: #774

New torrent repository using a FxHashMap for the peer list instead of a BTreeMap.

WIP: Some tests fail because it does not keep the order. This PR is only intended to check the performance. The performance is similar to the BTreeMap, so replacing it does not make sense if we lose the order. The order makes results deterministic.

BTreeMap:

Requests out: 400847.83/second
Responses in: 361008.64/second
  - Connect responses:  178712.68
  - Announce responses: 178730.98
  - Scrape responses:   3564.99
  - 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: 105
  - p99.9: 293
  - p100: 363

FxHashMap:

Requests out: 398119.46/second
Responses in: 358307.63/second
  - Connect responses:  177148.18
  - Announce responses: 177562.09
  - Scrape responses:   3597.36
  - 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: 105
  - p99.9: 289
  - p100: 371

I won't merge it:

  • It's not finished. Test related to order are failing.
  • It does not make sense to lose the "order" if the performance is not much better.

instead of a BTreeMap.

Some tests fail becuase it does not keep the order.

The performace is similiar to the BTreeMap:

BTreeMap:

```output
Requests out: 400847.83/second
Responses in: 361008.64/second
  - Connect responses:  178712.68
  - Announce responses: 178730.98
  - Scrape responses:   3564.99
  - 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: 105
  - p99.9: 293
  - p100: 363
```

HashMap:

```output
Requests out: 410866.90/second
Responses in: 368759.97/second
  - Connect responses:  182729.63
  - Announce responses: 182390.37
  - Scrape responses:   3639.97
  - 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: 105
  - p99.9: 297
  - p100: 365
```
This collection uses a faster hasher. The performance is similar.

With FxHashMap:

```output
Requests out: 398119.46/second
Responses in: 358307.63/second
  - Connect responses:  177148.18
  - Announce responses: 177562.09
  - Scrape responses:   3597.36
  - 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: 105
  - p99.9: 289
  - p100: 371
```

With BTreeMap:

```output
Requests out: 400847.83/second
Responses in: 361008.64/second
  - Connect responses:  178712.68
  - Announce responses: 178730.98
  - Scrape responses:   3564.99
  - 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: 105
  - p99.9: 293
  - p100: 363
```

It does not make sense sice the collections is not ordered and the
performace is similar.
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.

1 participant