Skip to content

v1.0.4

Compare
Choose a tag to compare
@alanmcgovern alanmcgovern released this 30 Oct 18:36

General

  • Significant reduction in memory allocations while downloading torrents by replacing async Task method declarations with async ReusableTask. This is a feature of the https://github.com/alanmcgovern/ReusableTasks project, which is also available on NuGet https://www.nuget.org/packages/ReusableTasks.
  • The IConnection interface has been superseded by IConnection2. The only difference is that the three main methods, ConnectAsync, SendAsync and ReceiveAsync are now typed as ReusableTask instead of Task. If anyone is implementing their own IConnection it is strongly recommended to use IConnection2 so that the ReusableTask variants of the three methods can be used instead of the Task variants. However, connections which implement IConnection are still fully supported
  • Migrated to System.Numeric.BigInteger instead of an old imported copy of Mono's BigInteger class. The System.Numeric version is significantly more performant than then decade old version from Mono.
  • Small tweak to how peers connection retries operate. If a connection could be established and an encrypted handshake fails, we immediately retry with an unencrypted handshake, and vice versa. This means connectable peers will have both methods checked immediately, increasing the chance of an active connection being established quickly. Previously the peer would be added to the end of the list and would be retried a long time after the initial attempt.

Performance Data

NoDht_Optimised

This screenshot shows the total allocated objects throughout the lifetime of a session which downloaded two torrents, totalling 3.2GB of data. The latest round of optimisations drastically reduced the allocations to 60MB in total.