Skip to content

Commit 9780dc3

Browse files
committed
rename OrderlyAllocator -> Allocator
The consumer can `use _ as _` if they like. reword docs
1 parent 06878d2 commit 9780dc3

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
`orderly-allocator`
22
===================
33

4-
A super simple fast soft-realtime allocator for managing an external pool of
5-
memory
4+
A super-simple fast soft-realtime allocator for managing an external pool of
5+
memory.
66

77
Since the pool of memory it manages is external, it could be useful as a
88
suballocator for e.g. a GPU buffer.
99

10-
Has worst-case *O(log(n))* performance for `alloc` & `free`, but provides a
10+
Has worst-case *O(log(n))*\* performance for `alloc` & `free`, but provides a
1111
*best-fit* search strategy & immediately coalesces on `free` resulting in low
1212
fragmentation.
1313

@@ -26,11 +26,11 @@ implementation.
2626

2727
### Future Work
2828

29-
Currently, the BTree implementation at the heart of `orderly-allocator` asks
29+
*Currently, the BTree implementation at the heart of `orderly-allocator` asks
3030
the global-allocator for memory for newly-created nodes every now and then. It
3131
would be possible to turn this into a firm- or hard-realtime allocator by using
32-
a different BTree implementation which pulled new nodes from a preallocated
33-
set.
32+
a different BTree implementation which preallocated as set of nodes ahead of
33+
time.
3434

3535

3636
### Other Libraries
@@ -54,6 +54,7 @@ This crate is licensed under any of the [Apache license 2.0], or the
5454
[MIT license]: ./LICENSE-MIT
5555
[Zlib license]: ./LICENSE-ZLIB
5656

57+
5758
### Contribution
5859

5960
Unless explicitly stated otherwise, any contributions you intentionally submit

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct Allocation {
1818
pub size: NonZero<Size>,
1919
}
2020

21-
/// A super simple fast soft-realtime allocator for managing an external pool
21+
/// A super-simple fast soft-realtime allocator for managing an external pool
2222
/// of memory
2323
///
2424
/// Since the pool of memory it manages is external, it could be useful as a
@@ -35,7 +35,7 @@ pub struct Allocation {
3535
/// ~100,000 separate free-regions, a worst-case lookup will traverse only 5
3636
/// tree nodes.
3737
#[derive(Clone)]
38-
pub struct OrderlyAllocator {
38+
pub struct Allocator {
3939
/// An ordered collection of free-regions, sorted primarily by size, then by
4040
/// location
4141
free: BTreeSet<FreeRegion>,
@@ -74,15 +74,15 @@ impl Ord for FreeRegion {
7474
}
7575
}
7676

77-
impl OrderlyAllocator {
77+
impl Allocator {
7878
/// Create a new allocator to manage a pool of memory
7979
///
8080
/// Panics:
8181
/// - Panics if `capacity == 0`
8282
pub fn new(capacity: Size) -> Self {
8383
let capacity = NonZero::new(capacity).expect("`capacity == 0`");
8484

85-
let mut allocator = OrderlyAllocator {
85+
let mut allocator = Allocator {
8686
free: BTreeSet::new(),
8787
location_map: BTreeMap::new(),
8888
capacity,
@@ -290,9 +290,9 @@ impl OrderlyAllocator {
290290
}
291291
}
292292

293-
impl fmt::Debug for OrderlyAllocator {
293+
impl fmt::Debug for Allocator {
294294
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
295-
f.debug_struct("OrderlyAllocator")
295+
f.debug_struct("Allocator")
296296
.field(&"capacity", &self.capacity)
297297
.field(&"total_available", &self.available)
298298
.field(&"largest_available", &self.largest_available())

0 commit comments

Comments
 (0)