Skip to content

Commit 908ddce

Browse files
committed
Move jemalloc to a legacy techniques section
1 parent dc323be commit 908ddce

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

README.md

+30-25
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,6 @@ Enable LTO in `Cargo.toml`:
8989
lto = true
9090
```
9191

92-
# Remove Jemalloc
93-
94-
![Minimum Rust: 1.28](https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-brightgreen.svg)
95-
![Maximum Rust: 1.31](https://img.shields.io/badge/Maximum%20Rust%20Version-1.31-brightgreen.svg)
96-
97-
> [!IMPORTANT]
98-
> As of Rust 1.32,
99-
> [`jemalloc` is removed by default](https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html).
100-
> **If using Rust 1.32 or newer, no action is needed to reduce binary size regarding this
101-
> feature**.
102-
103-
**Prior to Rust 1.32**, to improve performance on some platforms Rust bundled
104-
[jemalloc](https://github.com/jemalloc/jemalloc), an allocator that often
105-
outperforms the default system allocator. Bundling jemalloc added around 200KB
106-
to the resulting binary, however.
107-
108-
To remove `jemalloc` on Rust 1.28 - Rust 1.31, add this code to the top of `main.rs`:
109-
110-
```rust
111-
use std::alloc::System;
112-
113-
#[global_allocator]
114-
static A: System = System;
115-
```
116-
11792
# Reduce Parallel Code Generation Units to Increase Optimization
11893

11994
[By default][cargo-profile], Cargo specifies 16 parallel codegen units for release builds.
@@ -427,3 +402,33 @@ create minimum sized container images that run Rust binaries.
427402
- [wg-binary-size]: Working group for improving the size of Rust programs and libraries.
428403

429404
[wg-binary-size]: https://github.com/rust-lang/wg-binary-size
405+
406+
# Legacy Techniques
407+
408+
The following techniques are no longer relevant for modern Rust development, but may apply to older
409+
versions of Rust and are maintained for historical purposes.
410+
411+
## Remove Jemalloc
412+
413+
![Minimum Rust: 1.28](https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-brightgreen.svg)
414+
![Maximum Rust: 1.31](https://img.shields.io/badge/Maximum%20Rust%20Version-1.31-brightgreen.svg)
415+
416+
> [!IMPORTANT]
417+
> As of Rust 1.32,
418+
> [`jemalloc` is removed by default](https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html).
419+
> **If using Rust 1.32 or newer, no action is needed to reduce binary size regarding this
420+
> feature**.
421+
422+
**Prior to Rust 1.32**, to improve performance on some platforms Rust bundled
423+
[jemalloc](https://github.com/jemalloc/jemalloc), an allocator that often
424+
outperforms the default system allocator. Bundling jemalloc added around 200KB
425+
to the resulting binary, however.
426+
427+
To remove `jemalloc` on Rust 1.28 - Rust 1.31, add this code to the top of `main.rs`:
428+
429+
```rust
430+
use std::alloc::System;
431+
432+
#[global_allocator]
433+
static A: System = System;
434+
```

0 commit comments

Comments
 (0)