mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic: add #[inline] to handle_readable_socket and handlers
Also update aquatic_bench comment with new bench results
This commit is contained in:
parent
2fd732efc6
commit
32edee9bbb
3 changed files with 10 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ use crate::common::*;
|
|||
use crate::config::Config;
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn handle_connect_requests(
|
||||
state: &State,
|
||||
rng: &mut StdRng,
|
||||
|
|
@ -41,6 +42,7 @@ pub fn handle_connect_requests(
|
|||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn handle_announce_requests(
|
||||
state: &State,
|
||||
config: &Config,
|
||||
|
|
@ -128,6 +130,7 @@ pub fn handle_announce_requests(
|
|||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn handle_scrape_requests(
|
||||
state: &State,
|
||||
responses: &mut Vec<(Response, SocketAddr)>,
|
||||
|
|
@ -177,6 +180,7 @@ pub fn handle_scrape_requests(
|
|||
/// in order to avoid returning too homogeneous peers.
|
||||
///
|
||||
/// Don't care if we send back announcing peer.
|
||||
#[inline]
|
||||
pub fn extract_response_peers(
|
||||
rng: &mut impl Rng,
|
||||
peer_map: &PeerMap,
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ fn create_socket(config: &Config) -> ::std::net::UdpSocket {
|
|||
|
||||
|
||||
/// Read requests, generate and send back responses
|
||||
#[inline]
|
||||
fn handle_readable_socket(
|
||||
state: &State,
|
||||
config: &Config,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
//!
|
||||
//! Example summary output:
|
||||
//! ```
|
||||
//! ## Average results over 10 rounds
|
||||
//!
|
||||
//! Connect handler: 2 280 522 requests/second, 439.29 ns/request
|
||||
//! Announce handler: 267 790 requests/second, 3736.05 ns/request
|
||||
//! Scrape handler: 570 958 requests/second, 1751.89 ns/request
|
||||
//! ## Average results over 50 rounds
|
||||
//!
|
||||
//! Connect handler: 2 613 265 requests/second, 383.21 ns/request
|
||||
//! Announce handler: 293 403 requests/second, 3427.20 ns/request
|
||||
//! Scrape handler: 670 001 requests/second, 1492.61 ns/request
|
||||
//! ```
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue