rust-bitcoin-unsafe-fast/src/network
Riccardo Casatta 9c3a27a326
Merge rust-bitcoin/rust-bitcoin#680: Deprecate `StreamReader`
e860333bf3 Fix typos (Riccardo Casatta)
9189539715 Use BufReader internally in StreamReader to avoid performance regression on existing callers (Riccardo Casatta)
5dfb93df71 Deprecate StreamReader (Riccardo Casatta)
9ca6c75b18 Bench StreamReader (Riccardo Casatta)

Pull request description:

  `StreamReader` performance is extremely poor in case the object decoded is "big enough" for example a full Block.

  In the common case, the buffer is 64k, so to successfully parse a 1MB block 16 decode attempts are made.
  Even if a user increases the buffer size, `read` is not going to necessarily fill the buffer, as stated in the doc https://doc.rust-lang.org/stable/std/io/trait.Read.html#tymethod.read. In my tests, the reads are 64kB even with a 1MB buffer.

  I think this is the root issue of the performance issue found in electrs in https://github.com/romanz/electrs/issues/547 and they now have decided to decode the TCP stream with their own code in cd0531b8b7 and 05e0221b8e.

  Using directly `consensus_encode` seems to make more sense (taking care of using `BufRead` if necessary) so the `StreamReader` is deprecated

ACKs for top commit:
  Kixunil:
    ACK e860333bf3
  apoelstra:
    ACK e860333bf3

Tree-SHA512: a15a14f3f087be36271da5008d8dfb63866c9ddeb5ceb0e328b4a6d870131132a8b05103f7a3fed231f5bca099865efd07856b4766834d56ce2384b1bcdb889b
2022-01-06 13:28:32 +01:00
..
address.rs Fixed a bunch of clippy lints, added clippy.toml 2021-12-21 22:50:13 +01:00
constants.rs Clean up module level rustdocs 2021-11-06 10:59:53 +11:00
message.rs Fixed a bunch of clippy lints, added clippy.toml 2021-12-21 22:50:13 +01:00
message_blockdata.rs Fixed a bunch of clippy lints, added clippy.toml 2021-12-21 22:50:13 +01:00
message_bloom.rs Clean up module level rustdocs 2021-11-06 10:59:53 +11:00
message_filter.rs Clean up module level rustdocs 2021-11-06 10:59:53 +11:00
message_network.rs Fixed a bunch of clippy lints, added clippy.toml 2021-12-21 22:50:13 +01:00
mod.rs Clean up module level rustdocs 2021-11-06 10:59:53 +11:00
stream_reader.rs Fix typos 2022-01-05 09:39:57 +01:00