Switch Table::serialize to FxHashSet

This commit is contained in:
Alex Orlenko 2021-11-07 14:49:19 +00:00
parent 204eedde3c
commit b0da2fc439
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 3 additions and 2 deletions

View File

@ -2,8 +2,9 @@ use std::marker::PhantomData;
#[cfg(feature = "serialize")]
use {
rustc_hash::FxHashSet,
serde::ser::{self, Serialize, SerializeMap, SerializeSeq, Serializer},
std::{cell::RefCell, collections::HashSet, os::raw::c_void, result::Result as StdResult},
std::{cell::RefCell, os::raw::c_void, result::Result as StdResult},
};
use crate::error::{Error, Result};
@ -623,7 +624,7 @@ impl<'lua> Serialize for Table<'lua> {
S: Serializer,
{
thread_local! {
static VISITED: RefCell<HashSet<*const c_void>> = RefCell::new(HashSet::new());
static VISITED: RefCell<FxHashSet<*const c_void>> = RefCell::new(FxHashSet::default());
}
let lua = self.0.lua;