mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +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;
|
use crate::config::Config;
|
||||||
|
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn handle_connect_requests(
|
pub fn handle_connect_requests(
|
||||||
state: &State,
|
state: &State,
|
||||||
rng: &mut StdRng,
|
rng: &mut StdRng,
|
||||||
|
|
@ -41,6 +42,7 @@ pub fn handle_connect_requests(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn handle_announce_requests(
|
pub fn handle_announce_requests(
|
||||||
state: &State,
|
state: &State,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
|
@ -128,6 +130,7 @@ pub fn handle_announce_requests(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn handle_scrape_requests(
|
pub fn handle_scrape_requests(
|
||||||
state: &State,
|
state: &State,
|
||||||
responses: &mut Vec<(Response, SocketAddr)>,
|
responses: &mut Vec<(Response, SocketAddr)>,
|
||||||
|
|
@ -177,6 +180,7 @@ pub fn handle_scrape_requests(
|
||||||
/// in order to avoid returning too homogeneous peers.
|
/// in order to avoid returning too homogeneous peers.
|
||||||
///
|
///
|
||||||
/// Don't care if we send back announcing peer.
|
/// Don't care if we send back announcing peer.
|
||||||
|
#[inline]
|
||||||
pub fn extract_response_peers(
|
pub fn extract_response_peers(
|
||||||
rng: &mut impl Rng,
|
rng: &mut impl Rng,
|
||||||
peer_map: &PeerMap,
|
peer_map: &PeerMap,
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ fn create_socket(config: &Config) -> ::std::net::UdpSocket {
|
||||||
|
|
||||||
|
|
||||||
/// Read requests, generate and send back responses
|
/// Read requests, generate and send back responses
|
||||||
|
#[inline]
|
||||||
fn handle_readable_socket(
|
fn handle_readable_socket(
|
||||||
state: &State,
|
state: &State,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
//!
|
//!
|
||||||
//! Example summary output:
|
//! Example summary output:
|
||||||
//! ```
|
//! ```
|
||||||
//! ## Average results over 10 rounds
|
//! ## Average results over 50 rounds
|
||||||
//!
|
//!
|
||||||
//! Connect handler: 2 280 522 requests/second, 439.29 ns/request
|
//! Connect handler: 2 613 265 requests/second, 383.21 ns/request
|
||||||
//! Announce handler: 267 790 requests/second, 3736.05 ns/request
|
//! Announce handler: 293 403 requests/second, 3427.20 ns/request
|
||||||
//! Scrape handler: 570 958 requests/second, 1751.89 ns/request
|
//! Scrape handler: 670 001 requests/second, 1492.61 ns/request
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue