document sparse set #18

Manually merged
bitsyndicate merged 4 commits from sparse-set-docs into main 2025-05-06 18:29:36 +00:00
Owner
No description provided.
bitsyndicate added the
Kind/Documentation
label 2025-05-04 22:34:32 +00:00
bitsyndicate self-assigned this 2025-05-04 22:34:32 +00:00
bitsyndicate added 2 commits 2025-05-04 22:34:39 +00:00
docs: write documentation for sparse set
Some checks failed
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Successful in 3m39s
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Successful in 3m23s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Successful in 7m39s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Has been cancelled
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Has been cancelled
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (push) Has been cancelled
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (pull_request) Successful in 9m36s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Successful in 8m36s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Successful in 8m52s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Successful in 9m29s
c32f8126e9
bitsyndicate changed title from document sparse set to WIP: document sparse set 2025-05-04 22:34:58 +00:00
bitsyndicate changed title from WIP: document sparse set to document sparse set 2025-05-04 22:35:13 +00:00
requested reviews from lily, caznix 2025-05-04 22:35:18 +00:00
lily requested changes 2025-05-04 22:42:42 +00:00
Dismissed
@ -13,0 +15,4 @@
/// The sparse allocator is mainly used for bulk allocations in the system's page size
/// for the lookup array. It will also be used for the array of pointers into those
/// bulk allocations. Additionally it will be used for the reverse map that generates keys
/// from the value in the internal packed array
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -13,0 +21,4 @@
///
/// All operations on this datastructure, meaning insertion, lookup, and deletion, are `O(1)`.
///
/// This datastructure does not in any way guarantee ordering of the values on
Owner

"datastructure" is two words not one (i.e. data structure).

"datastructure" is two words not one (i.e. data structure).
bitsyndicate marked this conversation as resolved
@ -18,1 +32,4 @@
/// The paginated array of keys. The value at the key is an index into the dense array minus
/// one where the value corresponding to that key is stored.
sparse: Vec<SparsePage<SparseAlloc>, SparseAlloc>,
/// The dense array where the values corresponding to the keys are stored
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -18,2 +34,4 @@
sparse: Vec<SparsePage<SparseAlloc>, SparseAlloc>,
/// The dense array where the values corresponding to the keys are stored
dense: Vec<T, PackedAlloc>,
/// The reverse map to get the index in the sparse array from the index in the dense array
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -52,15 +105,39 @@ where
}
}
/// Gets the value with the key `id`
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -84,6 +161,15 @@ where
}
}
/// Gets the index in the dense array for a key `id`
Owner

Nit, missing period.

Nit, missing period.
@ -92,2 +178,4 @@
}
/// This reduces the usage count for a page in the sparse array, deallocating
/// it if it is not used anymore
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -103,6 +191,7 @@ where
}
}
/// Increase the page usage count for a page in the sparse array
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -133,3 +243,4 @@
self.len() == 0
}
/// Returns the number of values in this sparse set
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -137,3 +258,4 @@
self.dense.len()
}
/// Checks if the sparse set contains a value with key `id`
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
@ -149,3 +315,4 @@
&self.dense
}
/// Mutable version of [`Self::keys`]
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
bitsyndicate added 1 commit 2025-05-04 22:46:11 +00:00
chore: fix missing periods
Some checks are pending
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Waiting to run
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (push) Blocked by required conditions
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Blocked by required conditions
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Blocked by required conditions
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Blocked by required conditions
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Successful in 7m4s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (pull_request) Successful in 7m26s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Successful in 7m37s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Successful in 7m52s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Successful in 7m54s
8b16afb604
requested review from lily 2025-05-04 22:48:01 +00:00
bitsyndicate force-pushed sparse-set-docs from 8b16afb604 to 2704efbd9b 2025-05-04 22:50:11 +00:00 Compare
lily requested changes 2025-05-04 22:51:19 +00:00
Dismissed
@ -10,17 +10,36 @@ use bytemuck::Contiguous;
const SPARSE_PAGESIZE: usize = (1 << 10) * 4;
type SparsePage<A> = Option<(Box<[Option<NonZeroUsize>; SPARSE_PAGESIZE], A>, usize)>;
/// A sparse set for fast lookup of large indices
Owner

Nit, missing period.

Nit, missing period.
bitsyndicate marked this conversation as resolved
requested review from lily 2025-05-04 22:56:22 +00:00
bitsyndicate added 1 commit 2025-05-04 22:56:53 +00:00
chore: fix another missing period
All checks were successful
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Successful in 6m15s
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Successful in 6m12s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Successful in 7m54s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (push) Successful in 8m34s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Successful in 7m34s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Successful in 7m58s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Successful in 8m9s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (pull_request) Successful in 8m50s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Successful in 8m5s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Successful in 8m37s
1dd5b549c4
lily approved these changes 2025-05-04 22:57:37 +00:00
caznix approved these changes 2025-05-06 18:27:11 +00:00
caznix left a comment
Owner

LGTM

LGTM
bitsyndicate manually merged commit 010ee908b0 into main 2025-05-06 18:29:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: nonsensical-dev/zenyx-engine#18
No description provided.