mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Use pool for MultiValue container
This commit is contained in:
+1
-6
@@ -1,10 +1,9 @@
|
||||
use std::any::TypeId;
|
||||
use std::cell::UnsafeCell;
|
||||
use std::rc::Rc;
|
||||
// use std::collections::VecDeque;
|
||||
use std::mem::{self, MaybeUninit};
|
||||
use std::os::raw::{c_int, c_void};
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use parking_lot::Mutex;
|
||||
@@ -28,7 +27,6 @@ use super::{Lua, WeakLua};
|
||||
static EXTRA_REGISTRY_KEY: u8 = 0;
|
||||
|
||||
const WRAPPED_FAILURE_POOL_SIZE: usize = 64;
|
||||
// const MULTIVALUE_POOL_SIZE: usize = 64;
|
||||
const REF_STACK_RESERVE: c_int = 1;
|
||||
|
||||
/// Data associated with the Lua state.
|
||||
@@ -61,8 +59,6 @@ pub(crate) struct ExtraData {
|
||||
|
||||
// Pool of `WrappedFailure` enums in the ref thread (as userdata)
|
||||
pub(super) wrapped_failure_pool: Vec<c_int>,
|
||||
// Pool of `MultiValue` containers
|
||||
// multivalue_pool: Vec<VecDeque<Value>>,
|
||||
// Pool of `Thread`s (coroutines) for async execution
|
||||
#[cfg(feature = "async")]
|
||||
pub(super) thread_pool: Vec<c_int>,
|
||||
@@ -162,7 +158,6 @@ impl ExtraData {
|
||||
ref_stack_top: ffi::lua_gettop(ref_thread),
|
||||
ref_free: Vec::new(),
|
||||
wrapped_failure_pool: Vec::with_capacity(WRAPPED_FAILURE_POOL_SIZE),
|
||||
// multivalue_pool: Vec::with_capacity(MULTIVALUE_POOL_SIZE),
|
||||
#[cfg(feature = "async")]
|
||||
thread_pool: Vec::new(),
|
||||
wrapped_failure_mt_ptr,
|
||||
|
||||
@@ -496,25 +496,6 @@ impl RawLua {
|
||||
false
|
||||
}
|
||||
|
||||
// FIXME
|
||||
// #[inline]
|
||||
// pub(crate) fn pop_multivalue_from_pool(&self) -> Option<VecDeque<Value>> {
|
||||
// let extra = unsafe { &mut *self.extra.get() };
|
||||
// extra.multivalue_pool.pop()
|
||||
// }
|
||||
|
||||
// FIXME
|
||||
// #[inline]
|
||||
// pub(crate) fn push_multivalue_to_pool(&self, mut multivalue: VecDeque<Value>) {
|
||||
// let extra = unsafe { &mut *self.extra.get() };
|
||||
// if extra.multivalue_pool.len() < MULTIVALUE_POOL_SIZE {
|
||||
// multivalue.clear();
|
||||
// extra
|
||||
// .multivalue_pool
|
||||
// .push(unsafe { mem::transmute(multivalue) });
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Pushes a value that implements `IntoLua` onto the Lua stack.
|
||||
///
|
||||
/// Uses 2 stack spaces, does not call checkstack.
|
||||
|
||||
@@ -8,7 +8,6 @@ use crate::state::{ExtraData, RawLua};
|
||||
use crate::util::{self, get_internal_metatable, WrappedFailure};
|
||||
|
||||
const WRAPPED_FAILURE_POOL_SIZE: usize = 64;
|
||||
// const MULTIVALUE_POOL_SIZE: usize = 64;
|
||||
|
||||
pub(super) struct StateGuard<'a>(&'a RawLua, *mut ffi::lua_State);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user