Revert "Set hash buckets as 2 to work around performance bottleneck"

This reverts commit 631ab21838.
This commit is contained in:
Ruihan Li
2025-03-18 20:28:35 +08:00
committed by Tate, Hongliang Tian
parent 7f323ac501
commit 2f66f5d234

View File

@ -147,11 +147,9 @@ pub(crate) struct SocketTable<E: Ext> {
// On Linux, the number of buckets is determined at runtime based on the available memory.
// For simplicity, we use fixed values here.
// The bucket count should be a power of 2 to ensure efficient modulo calculations.
// FIXME: We have reduced the bucket count to 2 because iterating over all buckets has become a bottleneck.
// Once we can avoid such iterations, we should set more meaningful bucket counts.
const LISTENER_BUCKET_COUNT: u32 = 2;
const LISTENER_BUCKET_COUNT: u32 = 64;
const LISTENER_BUCKET_MASK: u32 = LISTENER_BUCKET_COUNT - 1;
const CONNECTION_BUCKET_COUNT: u32 = 2;
const CONNECTION_BUCKET_COUNT: u32 = 8192;
const CONNECTION_BUCKET_MASK: u32 = CONNECTION_BUCKET_COUNT - 1;
const_assert!(LISTENER_BUCKET_COUNT.is_power_of_two());