Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions benches/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

use criterion::{criterion_group, criterion_main, Criterion};
use pushpin::core::list;
use pushpin::core::list::{List, Node, RcList, RcNode, SlabList, SlabNode};
use pushpin::core::memorypool;
use slab::Slab;
use std::rc::Rc;
Expand All @@ -30,11 +30,11 @@ fn criterion_benchmark(c: &mut Criterion) {
c.bench_function(&format!("slab-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut nodes = nodes_slab.take().unwrap();
let mut l = list::List::default();
let mut l = List::default();

let mut next_value: u64 = 0;
while nodes.len() < nodes.capacity() {
let n = nodes.insert(list::Node::new(next_value));
let n = nodes.insert(Node::new(next_value));
l.push_back(&mut nodes, n);
next_value += 1;
}
Expand All @@ -59,11 +59,11 @@ fn criterion_benchmark(c: &mut Criterion) {
c.bench_function(&format!("gen-slab-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut nodes = nodes_slab.take().unwrap();
let mut l = list::SlabList::default();
let mut l = SlabList::default();

let mut next_value: u64 = 0;
while nodes.len() < nodes.capacity() {
let n = nodes.insert(list::SlabNode::new(next_value));
let n = nodes.insert(SlabNode::new(next_value));
l.push_back(&mut nodes, n);
next_value += 1;
}
Expand All @@ -89,11 +89,11 @@ fn criterion_benchmark(c: &mut Criterion) {

c.bench_function(&format!("mp-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut l = list::RcList::default();
let mut l = RcList::default();

let mut next_value: u64 = 0;
while next_value < node_count as u64 {
let n = list::RcNode::new(next_value, Some(&nodes_memory));
let n = RcNode::new(next_value, Some(&nodes_memory));
l.push_back(n);
next_value += 1;
}
Expand All @@ -113,11 +113,11 @@ fn criterion_benchmark(c: &mut Criterion) {

c.bench_function(&format!("sys-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut l = list::RcList::default();
let mut l = RcList::default();

let mut next_value: u64 = 0;
while next_value < node_count as u64 {
let n = list::RcNode::new(next_value, None);
let n = RcNode::new(next_value, None);
l.push_back(n);
next_value += 1;
}
Expand All @@ -140,14 +140,14 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut nodes = Vec::new();
let mut next_value: u64 = 0;
while nodes_memory.len() < nodes_memory.capacity() {
let n = list::RcNode::new(next_value, Some(&nodes_memory));
let n = RcNode::new(next_value, Some(&nodes_memory));
nodes.push(n);
next_value += 1;
}

c.bench_function(&format!("pre-mp-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut l = list::RcList::default();
let mut l = RcList::default();

for n in &nodes {
l.push_back(n.clone());
Expand All @@ -170,14 +170,14 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut nodes = Vec::new();
let mut next_value: u64 = 0;
while next_value < node_count as u64 {
let n = list::RcNode::new(next_value, None);
let n = RcNode::new(next_value, None);
nodes.push(n);
next_value += 1;
}

c.bench_function(&format!("pre-sys-push-pop-x{NODE_KCOUNT}k"), |b| {
b.iter(|| {
let mut l = list::RcList::default();
let mut l = RcList::default();

for n in &nodes {
l.push_back(n.clone());
Expand Down
10 changes: 5 additions & 5 deletions src/connmgr/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use crate::connmgr::zhttppacket;
use crate::connmgr::zhttpsocket::FROM_MAX;
use crate::core::list;
use crate::core::list::{SlabList, SlabNode};
use crate::core::memorypool;
use arrayvec::ArrayVec;
use slab::Slab;
Expand Down Expand Up @@ -81,11 +81,11 @@ impl<'a, 'b> BatchGroupWithIds<'a, 'b> {
struct AddrItem {
addr: ArrayVec<u8, FROM_MAX>,
use_router: bool,
keys: list::List,
keys: SlabList<usize>,
}

pub struct Batch {
nodes: Slab<list::Node<usize>>,
nodes: Slab<SlabNode<usize>>,
addrs: Vec<AddrItem>,
addr_index: usize,
group_ids: memorypool::ReusableVec,
Expand Down Expand Up @@ -152,7 +152,7 @@ impl Batch {
self.addrs.push(AddrItem {
addr,
use_router,
keys: list::List::default(),
keys: SlabList::default(),
});
} else {
// adding not allowed if take_group() has already moved past the index
Expand All @@ -161,7 +161,7 @@ impl Batch {
}
}

let nkey = self.nodes.insert(list::Node::new(ckey));
let nkey = self.nodes.insert(SlabNode::new(ckey));
self.addrs[pos].keys.push_back(&mut self.nodes, nkey);

Ok(BatchKey {
Expand Down
10 changes: 5 additions & 5 deletions src/connmgr/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::core::buffer::TmpBuffer;
use crate::core::channel::{self, AsyncLocalReceiver, AsyncLocalSender, AsyncReceiver};
use crate::core::event;
use crate::core::executor::{Executor, Spawner};
use crate::core::list;
use crate::core::list::{SlabList, SlabNode};
use crate::core::memorypool;
use crate::core::reactor::Reactor;
use crate::core::select::{select_2, select_5, select_6, select_option, Select2, Select5, Select6};
Expand Down Expand Up @@ -183,7 +183,7 @@ struct ConnectionItem {
}

struct ConnectionItems {
nodes: Slab<list::Node<ConnectionItem>>,
nodes: Slab<SlabNode<ConnectionItem>>,
nodes_by_id: HashMap<SessionKey, usize>,
batch: Batch,
}
Expand All @@ -199,7 +199,7 @@ impl ConnectionItems {
}

struct ConnectionsInner {
active: list::List,
active: SlabList<ConnectionItem>,
count: usize,
max: usize,
}
Expand All @@ -214,7 +214,7 @@ impl Connections {
Self {
items,
inner: RefCell::new(ConnectionsInner {
active: list::List::default(),
active: SlabList::default(),
count: 0,
max,
}),
Expand Down Expand Up @@ -244,7 +244,7 @@ impl Connections {
return Err(());
}

let nkey = items.nodes.insert(list::Node::new(ConnectionItem {
let nkey = items.nodes.insert(SlabNode::new(ConnectionItem {
id: None,
stop: Some(stop),
zreceiver_sender,
Expand Down
9 changes: 5 additions & 4 deletions src/connmgr/pool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2023 Fanout, Inc.
* Copyright (C) 2026 Fastly, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +15,7 @@
* limitations under the License.
*/

use crate::core::list;
use crate::core::list::{SlabList, SlabNode};
use crate::core::timer::TimerWheel;
use slab::Slab;
use std::borrow::Borrow;
Expand All @@ -35,8 +36,8 @@ struct PoolItem<K, V> {
}

pub struct Pool<K, V> {
nodes: Slab<list::SlabNode<PoolItem<K, V>>>,
by_key: HashMap<K, list::SlabList<PoolItem<K, V>>>,
nodes: Slab<SlabNode<PoolItem<K, V>>>,
by_key: HashMap<K, SlabList<PoolItem<K, V>>>,
wheel: TimerWheel,
start: Instant,
current_ticks: u64,
Expand Down Expand Up @@ -69,7 +70,7 @@ where

let timer_id = self.wheel.add(expires, nkey).unwrap();

entry.insert(list::SlabNode::new(PoolItem {
entry.insert(SlabNode::new(PoolItem {
key: key.clone(),
value,
timer_id,
Expand Down
13 changes: 7 additions & 6 deletions src/connmgr/resolver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2022 Fanout, Inc.
* Copyright (C) 2026 Fastly, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +16,7 @@
*/

use crate::core::event;
use crate::core::list;
use crate::core::list::{SlabList, SlabNode};
use crate::core::reactor::CustomEvented;
use crate::core::task::get_reactor;
use arrayvec::{ArrayString, ArrayVec};
Expand Down Expand Up @@ -54,8 +55,8 @@ struct QueryItem {

struct QueriesInner {
stop: bool,
nodes: Slab<list::Node<QueryItem>>,
next: list::List,
nodes: Slab<SlabNode<QueryItem>>,
next: SlabList<QueryItem>,
registrations: VecDeque<(event::Registration, event::SetReadiness)>,
invalidated_count: u32,
}
Expand All @@ -76,7 +77,7 @@ impl Queries {
let inner = QueriesInner {
stop: false,
nodes: Slab::with_capacity(queries_max),
next: list::List::default(),
next: SlabList::default(),
registrations,
invalidated_count: 0,
};
Expand Down Expand Up @@ -108,7 +109,7 @@ impl Queries {

let nkey = match Hostname::from(host) {
Ok(host) => {
let nkey = queries.nodes.insert(list::Node::new(QueryItem {
let nkey = queries.nodes.insert(SlabNode::new(QueryItem {
host,
result: None,
set_readiness: sr,
Expand All @@ -124,7 +125,7 @@ impl Queries {
Err(_) => {
sr.set_readiness(Interest::READABLE).unwrap();

queries.nodes.insert(list::Node::new(QueryItem {
queries.nodes.insert(SlabNode::new(QueryItem {
host: Hostname::new(),
result: Some(Err(io::Error::from(io::ErrorKind::InvalidInput))),
set_readiness: sr,
Expand Down
10 changes: 5 additions & 5 deletions src/connmgr/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::core::channel::{self, AsyncLocalReceiver, AsyncLocalSender, AsyncRece
use crate::core::event;
use crate::core::executor::{Executor, Spawner};
use crate::core::fs::{set_group, set_user};
use crate::core::list;
use crate::core::list::{SlabList, SlabNode};
use crate::core::memorypool;
use crate::core::net::{
set_socket_opts, AsyncTcpStream, AsyncUnixStream, NetListener, NetStream, SocketAddr,
Expand Down Expand Up @@ -297,7 +297,7 @@ struct ConnectionItem {
}

struct ConnectionItems {
nodes: Slab<list::Node<ConnectionItem>>,
nodes: Slab<SlabNode<ConnectionItem>>,
next_cid: u32,
batch: Batch,
}
Expand All @@ -313,7 +313,7 @@ impl ConnectionItems {
}

struct ConnectionsInner {
active: list::List,
active: SlabList<ConnectionItem>,
count: usize,
max: usize,
}
Expand All @@ -328,7 +328,7 @@ impl Connections {
Self {
items,
inner: RefCell::new(ConnectionsInner {
active: list::List::default(),
active: SlabList::default(),
count: 0,
max,
}),
Expand Down Expand Up @@ -357,7 +357,7 @@ impl Connections {
return Err(());
}

let nkey = items.nodes.insert(list::Node::new(ConnectionItem {
let nkey = items.nodes.insert(SlabNode::new(ConnectionItem {
id: ArrayString::new(),
stop: Some(stop),
zreceiver_sender,
Expand Down
Loading
Loading