Skip to content

Commit 4f8310c

Browse files
author
bors-servo
authored
Auto merge of #196 - nnethercote:rm-heapsize, r=jdm
Remove `heapsize` dependency. The heapsize crate is being deprecated in favour of the malloc_size_of crate within Servo. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/string-cache/196) <!-- Reviewable:end -->
2 parents 4a027b0 + f48bdff commit 4f8310c

File tree

5 files changed

+4
-43
lines changed

5 files changed

+4
-43
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ script:
1111
- cargo test
1212
- cargo test --features log-events
1313
- "if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --features unstable; fi"
14-
- cargo test --features heapsize
14+
- cargo test
1515
- "cd string-cache-codegen/ && cargo build && cd .."
1616
- "cd examples/event-log/ && cargo build && cd ../.."
1717
- "cd examples/summarize-events/ && cargo build && cd ../.."

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "string_cache"
4-
version = "0.6.3" # Also update README.md when making a semver-breaking change
4+
version = "0.7.0" # Also update README.md when making a semver-breaking change
55
authors = [ "The Servo Project Developers" ]
66
description = "A string interning library for Rust, developed as part of the Servo project."
77
license = "MIT / Apache-2.0"
@@ -33,7 +33,6 @@ lazy_static = "0.2"
3333
serde = "1"
3434
phf_shared = "0.7.4"
3535
debug_unreachable = "0.1.1"
36-
heapsize = { version = ">= 0.3, < 0.5", optional = true }
3736
string_cache_shared = {path = "./shared", version = "0.3"}
3837

3938
[dev-dependencies]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In `Cargo.toml`:
1212

1313
```toml
1414
[dependencies]
15-
string_cache = "0.6"
15+
string_cache = "0.7"
1616
```
1717

1818
In `lib.rs`:
@@ -31,7 +31,7 @@ In `Cargo.toml`:
3131
build = "build.rs"
3232

3333
[dependencies]
34-
string_cache = "0.5"
34+
string_cache = "0.7"
3535

3636
[build-dependencies]
3737
string_cache_codegen = "0.4"

src/atom.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
#![allow(non_upper_case_globals)]
1111

12-
#[cfg(feature = "heapsize")]
13-
use heapsize::HeapSizeOf;
14-
1512
use phf_shared;
1613
use serde::{Deserialize, Deserializer, Serialize, Serializer};
1714

@@ -46,43 +43,17 @@ struct StringCache {
4643
buckets: [Option<Box<StringCacheEntry>>; NB_BUCKETS],
4744
}
4845

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-
5646
lazy_static! {
5747
static ref STRING_CACHE: Mutex<StringCache> = Mutex::new(StringCache::new());
5848
}
5949

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-
7150
struct StringCacheEntry {
7251
next_in_bucket: Option<Box<StringCacheEntry>>,
7352
hash: u64,
7453
ref_count: AtomicIsize,
7554
string: Box<str>,
7655
}
7756

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-
8657
impl StringCacheEntry {
8758
fn new(next: Option<Box<StringCacheEntry>>, hash: u64, string: String)
8859
-> StringCacheEntry {
@@ -213,14 +184,6 @@ pub struct Atom<Static: StaticAtomSet> {
213184
pub phantom: PhantomData<Static>,
214185
}
215186

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-
224187
impl<Static: StaticAtomSet> ::precomputed_hash::PrecomputedHash for Atom<Static> {
225188
fn precomputed_hash(&self) -> u32 {
226189
self.get_hash()

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
1515

1616
#[cfg(all(test, feature = "unstable"))] extern crate test;
17-
#[cfg(feature = "heapsize")] extern crate heapsize;
1817
#[cfg(all(test, feature = "unstable"))] extern crate rand;
1918
#[macro_use] extern crate lazy_static;
2019
#[macro_use] extern crate debug_unreachable;

0 commit comments

Comments
 (0)