diff --git a/Cargo.lock b/Cargo.lock index 90b736db64..d50e156b34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5042,9 +5042,9 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smpl_jwt" @@ -7129,6 +7129,7 @@ dependencies = [ "rand 0.8.5", "rcgen", "rustls", + "smallvec", "solana-logger", "solana-metrics", "solana-perf", diff --git a/Cargo.toml b/Cargo.toml index 06670058df..78ecc627f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -295,6 +295,7 @@ sha2 = "0.10.7" sha3 = "0.10.4" signal-hook = "0.3.17" siphasher = "0.3.11" +smallvec = "1.13.2" smpl_jwt = "0.7.1" socket2 = "0.5.4" soketto = "0.7" diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 2a8ebc74b2..a449dee4ed 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -4391,9 +4391,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smpl_jwt" @@ -6179,6 +6179,7 @@ dependencies = [ "rand 0.8.5", "rcgen", "rustls", + "smallvec", "solana-metrics", "solana-perf", "solana-sdk", diff --git a/streamer/Cargo.toml b/streamer/Cargo.toml index 21ae96d11f..3c35fcb16c 100644 --- a/streamer/Cargo.toml +++ b/streamer/Cargo.toml @@ -28,6 +28,7 @@ quinn-proto = { workspace = true } rand = { workspace = true } rcgen = { workspace = true } rustls = { workspace = true, features = ["dangerous_configuration"] } +smallvec = { workspace = true } solana-metrics = { workspace = true } solana-perf = { workspace = true } solana-sdk = { workspace = true } diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index 7c1ac060d0..a3d2d4fa16 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -14,6 +14,7 @@ use { quinn::{Connecting, Connection, Endpoint, EndpointConfig, TokioRuntime, VarInt}, quinn_proto::VarIntBoundsExceeded, rand::{thread_rng, Rng}, + smallvec::SmallVec, solana_perf::packet::{PacketBatch, PACKETS_PER_BATCH}, solana_sdk::{ packet::{Meta, PACKET_DATA_SIZE}, @@ -95,7 +96,7 @@ struct PacketChunk { // the Packet and then when copying the Packet into a PacketBatch) struct PacketAccumulator { pub meta: Meta, - pub chunks: Vec, + pub chunks: SmallVec<[PacketChunk; 2]>, } #[allow(clippy::too_many_arguments)] @@ -911,7 +912,7 @@ async fn handle_chunk( meta.set_from_staked_node(matches!(peer_type, ConnectionPeerType::Staked)); *packet_accum = Some(PacketAccumulator { meta, - chunks: Vec::new(), + chunks: SmallVec::new(), }); } @@ -1496,7 +1497,7 @@ pub mod test { meta.size = size; let packet_accum = PacketAccumulator { meta, - chunks: vec![PacketChunk { + chunks: smallvec::smallvec![PacketChunk { bytes, offset, end_of_chunk: size,