|
9 | 9 |
|
10 | 10 | #![allow(non_upper_case_globals)] |
11 | 11 |
|
12 | | -#[cfg(feature = "heapsize")] |
13 | | -use heapsize::HeapSizeOf; |
14 | | - |
15 | 12 | use phf_shared; |
16 | 13 | use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
17 | 14 |
|
@@ -46,43 +43,17 @@ struct StringCache { |
46 | 43 | buckets: [Option<Box<StringCacheEntry>>; NB_BUCKETS], |
47 | 44 | } |
48 | 45 |
|
49 | | -#[cfg(feature = "heapsize")] |
50 | | -impl HeapSizeOf for StringCache { |
51 | | - fn heap_size_of_children(&self) -> usize { |
52 | | - self.buckets.iter().fold(0, |size, bucket| size + bucket.heap_size_of_children()) |
53 | | - } |
54 | | -} |
55 | | - |
56 | 46 | lazy_static! { |
57 | 47 | static ref STRING_CACHE: Mutex<StringCache> = Mutex::new(StringCache::new()); |
58 | 48 | } |
59 | 49 |
|
60 | | -/// A token that represents the heap used by the dynamic string cache. |
61 | | -#[cfg(feature = "heapsize")] |
62 | | -pub struct StringCacheHeap; |
63 | | - |
64 | | -#[cfg(feature = "heapsize")] |
65 | | -impl HeapSizeOf for StringCacheHeap { |
66 | | - fn heap_size_of_children(&self) -> usize { |
67 | | - STRING_CACHE.lock().unwrap().heap_size_of_children() |
68 | | - } |
69 | | -} |
70 | | - |
71 | 50 | struct StringCacheEntry { |
72 | 51 | next_in_bucket: Option<Box<StringCacheEntry>>, |
73 | 52 | hash: u64, |
74 | 53 | ref_count: AtomicIsize, |
75 | 54 | string: Box<str>, |
76 | 55 | } |
77 | 56 |
|
78 | | -#[cfg(feature = "heapsize")] |
79 | | -impl HeapSizeOf for StringCacheEntry { |
80 | | - fn heap_size_of_children(&self) -> usize { |
81 | | - self.next_in_bucket.heap_size_of_children() + |
82 | | - self.string.heap_size_of_children() |
83 | | - } |
84 | | -} |
85 | | - |
86 | 57 | impl StringCacheEntry { |
87 | 58 | fn new(next: Option<Box<StringCacheEntry>>, hash: u64, string: String) |
88 | 59 | -> StringCacheEntry { |
@@ -213,14 +184,6 @@ pub struct Atom<Static: StaticAtomSet> { |
213 | 184 | pub phantom: PhantomData<Static>, |
214 | 185 | } |
215 | 186 |
|
216 | | -#[cfg(feature = "heapsize")] |
217 | | -impl<Static: StaticAtomSet> HeapSizeOf for Atom<Static> { |
218 | | - #[inline(always)] |
219 | | - fn heap_size_of_children(&self) -> usize { |
220 | | - 0 |
221 | | - } |
222 | | -} |
223 | | - |
224 | 187 | impl<Static: StaticAtomSet> ::precomputed_hash::PrecomputedHash for Atom<Static> { |
225 | 188 | fn precomputed_hash(&self) -> u32 { |
226 | 189 | self.get_hash() |
|
0 commit comments