Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Box in ListNode & 2018 edition #29

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ documentation = "https://docs.rs/publicsuffix"
readme = "README.md"
keywords = ["tld", "gtld", "cctld", "domain", "psl"]
authors = ["rushmorem <rushmore@webenchanter.com>"]
edition = "2018"

[features]
default = ["remote_list"]
Expand All @@ -18,11 +19,16 @@ error-chain = { version = "0.12", default-features = false }
idna = "0.2"
regex = { version = "1.0", default-features = false, features = ["std"] }
url = "2.0"
lazy_static = "1.0"
lazy_static = "1.4"

[dependencies.native-tls]
version = "0.2"
optional = true

[dev_dependencies]
[dev-dependencies]
criterion = "0.3"
rspec = "=1.0.0-beta.3"

[[bench]]
name = "bench"
harness = false
28 changes: 12 additions & 16 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#![feature(test)]
use criterion::{black_box, criterion_group, criterion_main, Criterion};

extern crate test;

#[bench]
fn bench_com(b: &mut test::Bencher) {
fn criterion_benchmark(c: &mut Criterion) {
let list = publicsuffix::List::fetch().unwrap();
b.iter(|| {
let res = list.parse_domain("raw.github.com").unwrap();
assert_eq!(res.suffix().unwrap(), "com");
c.bench_function("bench raw.github.com", |b| {
b.iter(|| list.parse_domain(black_box("raw.github.com")).unwrap())
});
}

#[bench]
fn bench_jp(b: &mut test::Bencher) {
let list = publicsuffix::List::fetch().unwrap();
b.iter(|| {
let res = list.parse_domain("www.city.yamanashi.yamanashi.jp").unwrap();
assert_eq!(res.suffix().unwrap(), "yamanashi.yamanashi.jp");
c.bench_function("bench www.city.yamanashi.yamanashi.jp", |b| {
b.iter(|| {
list.parse_domain(black_box("www.city.yamanashi.yamanashi.jp"))
.unwrap()
})
});
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
3 changes: 2 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Errors returned by this library
/// Errors returned by this library
use error_chain::error_chain;

#[cfg(feature = "remote_list")]
use std::net::TcpStream;
Expand Down
Loading