Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bump to version 3.0.0!
  • Loading branch information
fitzgen committed Dec 20, 2019
1 parent e5d3076 commit 6366d49
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 4 deletions.
176 changes: 174 additions & 2 deletions CHANGELOG.md
@@ -1,12 +1,154 @@
* Add `alloc_str`, which is similar to `alloc_slice_*` methods, but works on
string slices.
## Unreleased

Released YYYY-MM-DD.

### Added

* TODO (or remove section if none)

### Changed

* TODO (or remove section if none)

### Deprecated

* TODO (or remove section if none)

### Removed

* TODO (or remove section if none)

### Fixed

* TODO (or remove section if none)

### Security

* TODO (or remove section if none)

--------------------------------------------------------------------------------

# 3.0.0

Released 2019-12-20.

## Added

* Added `Bump::alloc_str` for copying string slices into a `Bump`.

* Added `Bump::alloc_slice_copy` and `Bump::alloc_slice_clone` for copying or
cloning slices into a `Bump`.

* Added `Bump::alloc_slice_fill_iter` for allocating a slice in the `Bump` from
an iterator.

* Added `Bump::alloc_slice_fill_copy` and `Bump::alloc_slice_fill_clone` for
creating slices of length `n` that are filled with copies or clones of an
inital element.

* Added `Bump::alloc_slice_fill_default` for creating slices of length `n` with
the element type's default instance.

* Added `Bump::alloc_slice_fill_with` for creating slices of length `n` whose
elements are initialized with a function or closure.

* Added `Bump::iter_allocated_chunks` as a replacement for the old
`Bump::each_allocated_chunk`. The `iter_allocated_chunks` version returns an
iterator, which is more idiomatic than its old, callback-taking counterpart.
Additionally, `iter_allocated_chunks` exposes the chunks as `MaybeUninit`s
instead of slices, which makes it usable in more situations without triggering
undefined behavior. See also the note about bump direction in the "changed"
section; if you're iterating chunks, you're likely affected by that change!

* Added `Bump::with_capacity` so that you can pre-allocate a chunk with the
requested space.

### Changed

* **BREAKING:** The direction we allocate within a chunk has changed. It used to
be "upwards", from low addresses within a chunk towards high addresses. It is
now "downwards", from high addresses towards lower addresses.

Additionally, the order in which we iterate over allocated chunks has changed!
We used to iterate over chunks from oldest chunk to newest chunk, and now we
do the opposite: the youngest chunks are iterated over first, and the oldest
chunks are iterated over last.

If you were using `Bump::each_allocated_chunk` to iterate over data that you
had previously allocated, and *you want to iterate in order of allocation*,
you need to reverse the chunks iterator and also reverse the order in which
you loop through the data within a chunk!

For example, if you had this code:

```rust
unsafe {
bump.each_allocated_chunk(|chunk| {
for byte in chunk {
// Touch each byte in allocation order...
}
});
}
```

It should become this code:

```rust
let mut chunks: Vec<_> = bump.iter_allocated_chunks().collect();
chunks.reverse();
for chunk in chunks {
for byte in chunk.iter().rev() {
let byte = unsafe { byte.assume_init() };
// Touch each byte in allocation order...
}
}
```

The good news is that this change yielded a *speed up in allocation throughput
of 3-19%!*

See https://github.com/fitzgen/bumpalo/pull/37 and
https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html for details.

* **BREAKING:** The `collections` cargo feature is no longer on by default. You
must explicitly turn it on if you intend to use the `bumpalo::collections`
module.

* `Bump::reset` will now retain only the last allocated chunk (the biggest),
rather than only the first allocated chunk (the smallest). This should enable
`Bump` to better adapt to workload sizes and quickly reach a steady state
where new chunks are not requested from the global allocator.

### Removed

* The `Bump::each_allocated_chunk` method is removed in favor of
`Bump::iter_allocated_chunks`. Note that its safety requirements for reading
from the allocated chunks are slightly different from the old
`each_allocated_chunk`: only up to 16-byte alignment is supported now. If you
allocate anything with greater alignment than that into the bump arena, there
might be uninitilized padding inserted in the chunks, and therefore it is no
longer safe to read them via `MaybeUninit::assume_init`. See also the note
about bump direction in the "changed" section; if you're iterating chunks,
you're likely affected by that change!

* The `std` cargo feature has been removed, since this crate is now always
no-std.

## Fixed

* Fixed a bug involving potential integer overflows with large requested
allocation sizes.

--------------------------------------------------------------------------------

# 2.6.0

Released 2019-08-19.

* Implement `Send` for `Bump`.

--------------------------------------------------------------------------------

# 2.5.0

Released 2019-07-01.
Expand All @@ -15,6 +157,8 @@ Released 2019-07-01.
slices and either copy (with bound `T: Copy`) or clone (with bound `T: Clone`)
the provided slice's data into the newly allocated space.

--------------------------------------------------------------------------------

# 2.4.3

Released 2019-05-20.
Expand All @@ -24,6 +168,8 @@ Released 2019-05-20.
started growing largers chunks with larger layouts, we would deallocate those
chunks with an incorrect layout).

--------------------------------------------------------------------------------

# 2.4.2

Released 2019-05-17.
Expand All @@ -35,12 +181,16 @@ Released 2019-05-17.
of is very near the high end of the address space, and there is still
available address space lower down for new chunks.

--------------------------------------------------------------------------------

# 2.4.1

Released 2019-04-19.

* Added readme metadata to Cargo.toml so it shows up on crates.io

--------------------------------------------------------------------------------

# 2.4.0

Released 2019-04-19.
Expand All @@ -49,6 +199,8 @@ Released 2019-04-19.
the last allocation made from the bump arena. This should speed up various
`String`, `Vec`, and `format!` operations in many cases.

--------------------------------------------------------------------------------

# 2.3.0

Released 2019-03-26.
Expand All @@ -63,47 +215,61 @@ Released 2019-03-26.
[alloc-with-doc-comments]: https://github.com/fitzgen/bumpalo/blob/9f47aee8a6839ba65c073b9ad5372aacbbd02352/src/lib.rs#L436-L475
[issue-proposing-alloc-with]: https://github.com/fitzgen/bumpalo/issues/10

--------------------------------------------------------------------------------

# 2.2.2

Released 2019-03-18.

* Fix a regression from 2.2.1 where chunks were not always aligned to the chunk
footer's alignment.

--------------------------------------------------------------------------------

# 2.2.1

Released 2019-03-18.

* Fix a regression in 2.2.0 where newly allocated bump chunks could fail to have
capacity for a large requested bump allocation in some corner cases.

--------------------------------------------------------------------------------

# 2.2.0

Released 2019-03-15.

* Chunks in an arena now start out small, and double in size as more chunks are
requested.

--------------------------------------------------------------------------------

# 2.1.0

Released 2019-02-12.

* Added the `into_bump_slice` method on `bumpalo::collections::Vec<T>`.

--------------------------------------------------------------------------------

# 2.0.0

Released 2019-02-11.

* Removed the `BumpAllocSafe` trait.
* Correctly detect overflows from large allocations and panic.

--------------------------------------------------------------------------------

# 1.2.0

Released 2019-01-15.

* Fixed an overly-aggressive `debug_assert!` that had false positives.
* Ported to Rust 2018 edition.

--------------------------------------------------------------------------------

# 1.1.0

Released 2018-11-28.
Expand All @@ -112,8 +278,14 @@ Released 2018-11-28.
types that are compatible with backing their storage in `Bump` arenas.
* Lifted the limits on size and alignment of allocations.

--------------------------------------------------------------------------------

# 1.0.2

--------------------------------------------------------------------------------

# 1.0.1

--------------------------------------------------------------------------------

# 1.0.0
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -8,7 +8,7 @@ license = "MIT/Apache-2.0"
name = "bumpalo"
readme = "./README.md"
repository = "https://github.com/fitzgen/bumpalo"
version = "2.6.0"
version = "3.0.0"

[lib]
path = "src/lib.rs"
Expand Down

0 comments on commit 6366d49

Please sign in to comment.