Skip to content

Commit ea525cd

Browse files
committed
bench: remove D and C++ regex engines
Neither of them were particularly competitive and they make building the benchmark harness more trouble than it's worth.
1 parent 2f23f60 commit ea525cd

File tree

13 files changed

+3
-688
lines changed

13 files changed

+3
-688
lines changed

bench/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,7 @@ bench = false
4747
re-pcre1 = ["libpcre-sys"]
4848
re-pcre2 = []
4949
re-onig = ["onig"]
50-
re-stdcpp = []
51-
libcxx = []
52-
re-boost = []
5350
re-re2 = []
54-
re-dphobos = []
55-
re-dphobos-dmd = ["re-dphobos"]
56-
re-dphobos-dmd-ct = ["re-dphobos-dmd"]
57-
re-dphobos-ldc = ["re-dphobos"]
58-
re-dphobos-ldc-ct = ["re-dphobos-ldc"]
5951
re-rust = []
6052
re-rust-bytes = []
6153
re-tcl = []

bench/build.rs

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,9 @@
11
use std::env;
2-
use std::process;
32

43
fn main() {
54
if env::var("CARGO_FEATURE_RE_PCRE2").is_ok() {
65
pkg_config::probe_library("libpcre2-8").unwrap();
76
}
8-
if env::var("CARGO_FEATURE_RE_STDCPP").is_ok() {
9-
// stdcpp is a C++ library, so we need to compile our shim layer.
10-
if !env::var("CARGO_FEATURE_LIBCXX").is_ok() {
11-
// use default stdlib
12-
cc::Build::new()
13-
.cpp(true)
14-
.file("src/ffi/stdcpp.cpp")
15-
.compile("libcstdcpp.a");
16-
} else {
17-
// use libc++ stdlib
18-
cc::Build::new()
19-
.cpp(true)
20-
.file("src/ffi/stdcpp.cpp")
21-
.compiler("clang++")
22-
.cpp_link_stdlib("c++")
23-
.cpp_set_stdlib("c++")
24-
.compile("libcstdcpp.a");
25-
}
26-
}
27-
if env::var("CARGO_FEATURE_RE_BOOST").is_ok() {
28-
// stdcpp is a C++ library, so we need to compile our shim layer.
29-
cc::Build::new()
30-
.cpp(true)
31-
.file("src/ffi/stdcpp.cpp")
32-
.define("USE_BOOST", None)
33-
.compile("libcboost.a");
34-
println!("cargo:rustc-link-lib=boost_regex");
35-
}
367
if env::var("CARGO_FEATURE_RE_RE2").is_ok() {
378
// RE2 is a C++ library, so we need to compile our shim layer.
389
cc::Build::new()
@@ -46,84 +17,4 @@ fn main() {
4617
if env::var("CARGO_FEATURE_RE_TCL").is_ok() {
4718
pkg_config::probe_library("tcl").unwrap();
4819
}
49-
50-
if env::var("CARGO_FEATURE_RE_DPHOBOS_DMD").is_ok() {
51-
process::Command::new("dmd")
52-
.arg("--version")
53-
.stdout(process::Stdio::null())
54-
.stderr(process::Stdio::null())
55-
.spawn()
56-
.unwrap();
57-
58-
let out_dir = env::var("OUT_DIR").unwrap();
59-
let out_file = &format!("-of={}/libdphobos-dmd.a", out_dir);
60-
let is_compile_time =
61-
env::var("CARGO_FEATURE_RE_DPHOBOS_DMD_CT").is_ok();
62-
let extra_args =
63-
if is_compile_time { vec!["-version=CtRegex"] } else { vec![] };
64-
65-
let res = process::Command::new("dmd")
66-
.arg("-w")
67-
.arg("-lib")
68-
.arg("-O")
69-
.arg("-release")
70-
.arg("-inline")
71-
.arg("-Isrc/ffi")
72-
.args(extra_args)
73-
.arg("src/ffi/d_phobos.d")
74-
.arg("src/ffi/d_phobos_ct.d")
75-
.arg(out_file)
76-
.output()
77-
.expect("unable to compile dphobos-regex (dmd)");
78-
79-
if !res.status.success() {
80-
println!("{}", String::from_utf8_lossy(&res.stderr));
81-
}
82-
assert!(res.status.success());
83-
84-
println!("cargo:rustc-link-search=native={}", out_dir);
85-
println!("cargo:rustc-link-lib=dphobos-dmd");
86-
println!("cargo:rustc-link-lib=phobos2");
87-
}
88-
89-
if env::var("CARGO_FEATURE_RE_DPHOBOS_LDC").is_ok() {
90-
process::Command::new("ldc")
91-
.arg("--version")
92-
.stdout(process::Stdio::null())
93-
.stderr(process::Stdio::null())
94-
.spawn()
95-
.unwrap();
96-
97-
let out_dir = env::var("OUT_DIR").unwrap();
98-
let out_file = &format!("-of={}/libdphobos-ldc.a", out_dir);
99-
100-
let is_compile_time =
101-
env::var("CARGO_FEATURE_RE_DPHOBOS_LDC_CT").is_ok();
102-
let extra_args =
103-
if is_compile_time { vec!["-d-version=CtRegex"] } else { vec![] };
104-
105-
let res = process::Command::new("ldc")
106-
.arg("-w")
107-
.arg("-lib")
108-
.arg("-O3")
109-
.arg("-release")
110-
.arg("-mcpu=native")
111-
.arg("-Isrc/ffi")
112-
.args(extra_args)
113-
.arg("src/ffi/d_phobos.d")
114-
.arg("src/ffi/d_phobos_ct.d")
115-
.arg(out_file)
116-
.output()
117-
.expect("unable to compile dphobos-regex (ldc)");
118-
119-
if !res.status.success() {
120-
println!("{}", String::from_utf8_lossy(&res.stderr));
121-
}
122-
assert!(res.status.success());
123-
124-
println!("cargo:rustc-link-search=native={}", out_dir);
125-
println!("cargo:rustc-link-lib=dphobos-ldc");
126-
println!("cargo:rustc-link-lib=druntime-ldc");
127-
println!("cargo:rustc-link-lib=phobos2-ldc");
128-
}
12920
}

bench/run

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
usage() {
4-
echo "Usage: $(basename $0) [dphobos-dmd | dphobos-ldc | dphobos-dmd-ct | dphobos-ldc-ct | rust | rust-bytes | pcre1 | pcre2 | stdcpp | stdcpp-libcxx | boost | re2 | onig | tcl ]" >&2
4+
echo "Usage: $(basename $0) [rust | rust-bytes | pcre1 | pcre2 | re2 | onig | tcl ]" >&2
55
exit 1
66
}
77

@@ -12,33 +12,12 @@ fi
1212
which="$1"
1313
shift
1414
case $which in
15-
dphobos-dmd)
16-
exec cargo bench --bench bench --features re-dphobos-dmd "$@"
17-
;;
18-
dphobos-ldc)
19-
exec cargo bench --bench bench --features re-dphobos-ldc "$@"
20-
;;
21-
dphobos-dmd-ct)
22-
exec cargo bench --bench bench --features re-dphobos-dmd-ct "$@"
23-
;;
24-
dphobos-ldc-ct)
25-
exec cargo bench --bench bench --features re-dphobos-ldc-ct "$@"
26-
;;
2715
rust)
2816
exec cargo bench --bench bench --features re-rust "$@"
2917
;;
3018
rust-bytes)
3119
exec cargo bench --bench bench --features re-rust-bytes "$@"
3220
;;
33-
stdcpp)
34-
exec cargo bench --bench bench --features re-stdcpp "$@"
35-
;;
36-
stdcpp-libcxx)
37-
exec cargo bench --bench bench --features 're-stdcpp libcxx' "$@"
38-
;;
39-
boost)
40-
exec cargo bench --bench bench --features re-boost "$@"
41-
;;
4221
re2)
4322
exec cargo bench --bench bench --features re-re2 "$@"
4423
;;

bench/src/bench.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ cfg_if! {
1919
pub use regex::bytes::{Regex, RegexSet};
2020
} else if #[cfg(feature = "re-re2")] {
2121
pub use ffi::re2::Regex;
22-
} else if #[cfg(feature = "re-dphobos")] {
23-
pub use ffi::d_phobos::Regex;
2422
} else if #[cfg(feature = "re-pcre2")] {
2523
pub use ffi::pcre2::Regex;
26-
} else if #[cfg(any(feature = "re-stdcpp", feature = "re-boost"))] {
27-
pub use ffi::stdcpp::Regex;
2824
} else if #[cfg(feature = "re-tcl")] {
2925
pub use ffi::tcl::Regex;
3026
} else {
@@ -299,10 +295,7 @@ cfg_if! {
299295
feature = "re-rust",
300296
feature = "re-rust-bytes",
301297
feature = "re-re2",
302-
feature = "re-dphobos",
303298
feature = "re-pcre2",
304-
feature = "re-stdcpp",
305-
feature = "re-boost",
306299
feature = "re-tcl"
307300
))] {
308301
mod ffi;

bench/src/ffi/d_phobos.d

Lines changed: 0 additions & 63 deletions
This file was deleted.

bench/src/ffi/d_phobos.rs

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)