Skip to content

Commit

Permalink
Add hints about changing allocators
Browse files Browse the repository at this point in the history
references #142 and does it in one example

Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed May 19, 2024
1 parent a45ff99 commit 3052bf2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ CircleCI supports both methods:
- [Circle: direct folder cache (manual docker build)](https://github.com/clux/webapp-rs/blob/master/.circleci/config.yml)
- Circle also supports [docker layer caching](https://circleci.com/docs/2.0/docker-layer-caching/) (no example atm)

## Allocator Performance

To optimise memory performance (see [#142](https://github.com/clux/muslrust/issues/142)) consider changing the global allocators in sensitive applications:

- [jemalloc](https://github.com/tikv/jemallocator)
- [mimalloc](https://github.com/microsoft/mimalloc)

```rust
use tikv_jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
```

## Troubleshooting

### SSL Verification
Expand Down
2 changes: 2 additions & 0 deletions test/serdecrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
authors = ["clux <[email protected]>"]
name = "serdecrate"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = "1.0.15"
serde_derive = "1.0.15"
serde_json = "1.0.4"
tikv-jemallocator = "0.5.4"
9 changes: 5 additions & 4 deletions test/serdecrate/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[macro_use]
extern crate serde_derive;
use serde_derive::{Deserialize, Serialize};
use serde_json;

extern crate serde;
extern crate serde_json;
use tikv_jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

#[derive(Serialize, Deserialize, Debug)]
struct Point {
Expand Down

0 comments on commit 3052bf2

Please sign in to comment.