mirror of
https://github.com/lisk77/comet.git
synced 2025-10-25 06:18:49 +00:00
feat: added pagination to the SparseSet to make it more memory efficient
This commit is contained in:
parent
a42ac5b8fd
commit
ca3c3dd5e6
3 changed files with 57 additions and 29 deletions
|
|
@ -5,7 +5,6 @@ use std::{
|
|||
},
|
||||
any::TypeId,
|
||||
hash::{
|
||||
DefaultHasher,
|
||||
Hash,
|
||||
Hasher
|
||||
},
|
||||
|
|
@ -14,6 +13,9 @@ use std::{
|
|||
};
|
||||
use std::ptr;
|
||||
|
||||
// The following two structs are just blatantly stolen from Bevy - another Rust game engine.
|
||||
// I just need them for the ComponentStorage system, and I was too lazy to write them myself.
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BlobVec {
|
||||
item_layout: Layout,
|
||||
|
|
@ -24,7 +26,6 @@ pub struct BlobVec {
|
|||
drop: unsafe fn(*mut u8)
|
||||
}
|
||||
|
||||
|
||||
impl BlobVec {
|
||||
pub fn new(item_layout: Layout, drop: unsafe fn(*mut u8), capacity: usize) -> Self {
|
||||
if item_layout.size() == 0 {
|
||||
|
|
@ -84,7 +85,6 @@ impl BlobVec {
|
|||
self.capacity = new_capacity;
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
pub fn len(&self) -> usize {
|
||||
self.len
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue