Skip to content

Commit

Permalink
Merge pull request #146 from clux/allocator-hints
Browse files Browse the repository at this point in the history
Add hints about changing allocators
  • Loading branch information
clux authored May 19, 2024
2 parents 1cccb87 + 3052bf2 commit 39d8298
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 39d8298

Please sign in to comment.