Skip to content

Commit

Permalink
activate LTO and jemallocator for benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Feb 23, 2019
1 parent 027fe80 commit e17fe77
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ default-features = false

[dev-dependencies]
criterion = "0.2"
jemallocator = "^0.1"

[build-dependencies]
version_check = "^0.1"
Expand All @@ -55,6 +56,11 @@ version_check = "^0.1"
features = [ "alloc", "std", "regexp", "regexp_macros", "verbose-errors" ]
all-features = true

[profile.bench]
debug = true
lto = true
codegen-units = 1

[[test]]
name = "arithmetic"

Expand Down
4 changes: 4 additions & 0 deletions benches/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use criterion::Criterion;
use nom::digit;
Expand Down
5 changes: 4 additions & 1 deletion benches/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

use criterion::*;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use criterion::*;
use nom::IResult;
use std::env;
use std::fs::File;
Expand Down
5 changes: 4 additions & 1 deletion benches/ini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

use criterion::*;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use criterion::*;
use nom::{alphanumeric, multispace, space};

use std::str;
Expand Down
5 changes: 4 additions & 1 deletion benches/ini_complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

use criterion::*;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use criterion::*;
use nom::{alphanumeric, multispace, space};
use nom::types::CompleteByteSlice;

Expand Down
4 changes: 4 additions & 0 deletions benches/ini_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

use criterion::*;

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use nom::IResult;
use nom::types::CompleteStr;

Expand Down
4 changes: 4 additions & 0 deletions benches/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
extern crate nom;
#[macro_use]
extern crate criterion;
extern crate jemallocator;

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use criterion::Criterion;
use nom::{alphanumeric, recognize_float};
Expand Down

0 comments on commit e17fe77

Please sign in to comment.