Merge pull request #142 from Amareis/master
Added jemalloc feature for benchmark
This commit is contained in:
commit
aa88b015c2
11
README.md
11
README.md
@ -58,7 +58,18 @@ Ensure that there is no CPU-heavy process in background!
|
|||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
cd benchmark
|
cd benchmark
|
||||||
|
|
||||||
|
#measure all with system malloc
|
||||||
cargo bench
|
cargo bench
|
||||||
|
|
||||||
|
#measure only chat run
|
||||||
|
cargo bench -- "chat run"
|
||||||
|
|
||||||
|
#measure all with jemalloc
|
||||||
|
cargo bench --features jemalloc
|
||||||
|
|
||||||
|
#measure only simple run with jemalloc
|
||||||
|
cargo bench --features jemalloc -- "simple run"
|
||||||
```
|
```
|
||||||
|
|
||||||
Now HTML report is available at `benchmark/target/criterion/report`
|
Now HTML report is available at `benchmark/target/criterion/report`
|
||||||
|
@ -10,12 +10,16 @@ futures = "0.3.4"
|
|||||||
serde_json = "*"
|
serde_json = "*"
|
||||||
async-graphql-parser = { path = "../async-graphql-parser" }
|
async-graphql-parser = { path = "../async-graphql-parser" }
|
||||||
async-graphql = { path = ".." }
|
async-graphql = { path = ".." }
|
||||||
|
jemallocator = { version = "0.3.2", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
simple = { path = "simple" }
|
simple = { path = "simple" }
|
||||||
chat = { path = "chat" }
|
chat = { path = "chat" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
jemalloc = ["jemallocator"]
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "simple"
|
name = "simple"
|
||||||
harness = false
|
harness = false
|
||||||
|
@ -3,6 +3,10 @@ use async_graphql::{ObjectType, QueryResponse, Schema, SubscriptionType};
|
|||||||
use async_graphql_parser::{parse_query, query::Document};
|
use async_graphql_parser::{parse_query, query::Document};
|
||||||
use async_std::task;
|
use async_std::task;
|
||||||
|
|
||||||
|
#[cfg(feature = "jemalloc")]
|
||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||||
|
|
||||||
pub fn run<Query, Mutation, Subscription>(
|
pub fn run<Query, Mutation, Subscription>(
|
||||||
s: &Schema<Query, Mutation, Subscription>,
|
s: &Schema<Query, Mutation, Subscription>,
|
||||||
q: &str,
|
q: &str,
|
||||||
|
Loading…
Reference in New Issue
Block a user