Skip to content

Commit

Permalink
fix: fixed benchmarks after #166
Browse files Browse the repository at this point in the history
  • Loading branch information
pamburus committed Mar 23, 2024
1 parent 4df5035 commit 753ff3f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
run: cargo build --verbose --benches
- name: Run tests
run: cargo test --verbose
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["command-line-utilities"]
description = "Utility for viewing json-formatted log files."
keywords = ["cli", "human", "log"]
name = "hl"
version = "0.27.0-beta.4.5"
version = "0.27.0-beta.4.6"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ help:

## Build debug target
build:
@cargo build
@cargo build --benches
.PHONY: build

## Build release target
Expand Down
2 changes: 1 addition & 1 deletion benches/parse-and-format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn benchmark(c: &mut Criterion) {
for theme in ["classic", "one-dark-green-truecolor", "dmt"] {
c.bench_function(format!("{}/{}", name, theme), |b| {
let settings = Settings::default();
let parser = Parser::new(ParserSettings::new(&settings.fields.predefined, empty(), false));
let parser = Parser::new(ParserSettings::new(&settings.fields.predefined, empty(), false, None));
let formatter = RecordFormatter::new(
Arc::new(Theme::embedded(theme).unwrap()),
DateTimeFormatter::new(
Expand Down
2 changes: 1 addition & 1 deletion benches/ts-format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn ignore<T>(t: T) {

fn benchmark(c: &mut Criterion) {
let mut c = c.benchmark_group("ts-format");
let tsr = Timestamp::new("2020-06-27T00:48:30.466249792+00:00", None);
let tsr = Timestamp::new("2020-06-27T00:48:30.466249792+00:00");
let ts = tsr.parse().unwrap();
let tsn = ts.naive_local();
let tz = |secs| Tz::FixedOffset(FixedOffset::east_opt(secs).unwrap());
Expand Down
8 changes: 4 additions & 4 deletions benches/ts-parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ fn benchmark(c: &mut Criterion) {
b.iter(|| assert!(re.is_match(rfc3339)));
});
c.bench_function("as_rfc3339", |b| {
let ts = Timestamp::new(rfc3339, None);
let ts = Timestamp::new(rfc3339);
b.iter(|| assert!(ts.as_rfc3339().is_some()));
});
c.bench_function("parse unix", |b| {
let ts = Timestamp::new(unix, None);
let ts = Timestamp::new(unix);
b.iter(|| assert!(ts.parse().is_some()))
});
c.bench_function("parse unix microseconds", |b| {
let ts = Timestamp::new(unix_us, None);
let ts = Timestamp::new(unix_us);
b.iter(|| assert!(ts.parse().is_some()))
});

let mut c1 = None;
let mut n1 = 0;
c.bench_function("parse rfc3339", |b| {
let ts = Timestamp::new(rfc3339, None);
let ts = Timestamp::new(rfc3339);
let reg = Region::new(&GLOBAL);
b.iter(|| {
n1 += 1;
Expand Down

0 comments on commit 753ff3f

Please sign in to comment.