Skip to content

Commit a3ce796

Browse files
committed
Update CI and benchmark/test features.
1 parent 27ab657 commit a3ce796

File tree

48 files changed

+177
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+177
-123
lines changed

.github/workflows/Comprehensive.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Install latest nightly
15-
uses: actions-rs/toolchain@v1
15+
uses: dtolnay/rust-toolchain@stable
1616
with:
1717
toolchain: nightly
18-
override: true
1918
components: rustfmt, clippy
2019
- run: ci/comprehensive.sh
2120
- run: ALL_FEATURES=1 ci/comprehensive.sh

.github/workflows/Cross.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Cross
33
on:
44
[pull_request, workflow_dispatch]
55

6+
# NOTE: Use older toolchains since there's bugs cross-compiling
7+
# for some more recent architectures.
68
jobs:
79
cross:
810
name: Rust ${{matrix.target}}
@@ -24,26 +26,26 @@ jobs:
2426
- armv7-unknown-linux-gnueabihf
2527
- i686-unknown-linux-gnu
2628
- i686-unknown-linux-musl
27-
- mips-unknown-linux-gnu
28-
- mips64-unknown-linux-gnuabi64
29-
- mips64el-unknown-linux-gnuabi64
30-
- mipsel-unknown-linux-gnu
29+
#- mips-unknown-linux-gnu
30+
#- mips64-unknown-linux-gnuabi64
31+
#- mips64el-unknown-linux-gnuabi64
32+
#- mipsel-unknown-linux-gnu
3133
# NOTE: This fails on cross v0.2.1, which is unusual since
3234
# manually invoking the failing tests with qemu-5.1.0 passes.
3335
#- powerpc64le-unknown-linux-gnu
34-
- x86_64-unknown-linux-gnu
36+
# NOTE: This has glibc linker issues. Restore later.
37+
#- x86_64-unknown-linux-gnu
3538
- x86_64-unknown-linux-musl
3639

3740
# Windows
3841
- x86_64-pc-windows-gnu
3942

4043
steps:
41-
- uses: actions/checkout@v2
42-
- uses: actions-rs/toolchain@v1
44+
- uses: actions/checkout@v4
45+
- uses: dtolnay/rust-toolchain@stable
4346
with:
44-
toolchain: stable
47+
toolchain: 1.65.0
4548
target: ${{matrix.target}}
46-
override: true
4749
- uses: actions-rs/cargo@v1
4850
with:
4951
use-cross: true
@@ -77,12 +79,11 @@ jobs:
7779
- x86_64-unknown-netbsd
7880

7981
steps:
80-
- uses: actions/checkout@v2
81-
- uses: actions-rs/toolchain@v1
82+
- uses: actions/checkout@v4
83+
- uses: dtolnay/rust-toolchain@stable
8284
with:
83-
toolchain: stable
85+
toolchain: 1.65.0
8486
target: ${{matrix.target}}
85-
override: true
8687
- uses: actions-rs/cargo@v1
8788
with:
8889
use-cross: true

.github/workflows/Features.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Install latest nightly
15-
uses: actions-rs/toolchain@v1
15+
uses: dtolnay/rust-toolchain@stable
1616
with:
1717
toolchain: nightly
18-
override: true
1918
components: rustfmt, clippy
2019
- run: ci/test.sh
2120
- run: NIGHTLY=1 NO_STD=1 ci/test.sh

.github/workflows/OSX.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ jobs:
1515
- x86_64-apple-darwin
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions-rs/toolchain@v1
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
2020
with:
2121
toolchain: stable
2222
target: ${{matrix.target}}
23-
override: true
2423
- uses: actions-rs/cargo@v1
2524
with:
2625
use-cross: true

.github/workflows/Simple.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,35 @@ on:
44
[push, pull_request, workflow_dispatch]
55

66
jobs:
7+
build:
8+
name: Rust ${{matrix.rust}}
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
rust: [1.63.0]
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
- uses: dtolnay/rust-toolchain@stable
19+
with:
20+
toolchain: ${{matrix.rust}}
21+
- run: cargo check
22+
- run: cargo build
23+
724
test:
825
name: Rust ${{matrix.rust}}
926
runs-on: ubuntu-latest
1027
strategy:
1128
fail-fast: false
1229
matrix:
13-
rust: [1.51.0, stable, beta, nightly]
30+
rust: [1.65.0, stable, beta, nightly]
1431
steps:
15-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
1633
with:
1734
submodules: recursive
18-
- uses: dtolnay/rust-toolchain@master
35+
- uses: dtolnay/rust-toolchain@stable
1936
with:
2037
toolchain: ${{matrix.rust}}
2138
- run: cargo check
@@ -28,7 +45,7 @@ jobs:
2845
strategy:
2946
fail-fast: true
3047
steps:
31-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v4
3249
- name: Install latest nightly
3350
uses: actions-rs/toolchain@v1
3451
with:

.github/workflows/Valgrind.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Install latest nightly
15-
uses: actions-rs/toolchain@v1
15+
uses: dtolnay/rust-toolchain@stable
1616
with:
1717
toolchain: nightly
18-
override: true
1918
- run: sudo apt-get update
2019
- run: sudo apt-get install valgrind
2120
- run: cargo +nightly install cargo-valgrind

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111
- Updated the MSRV to 1.63.0 (1.65.0 for development).
1212

13+
### Removed
14+
- Support for mips (MIPS), mipsel (MIPS LE), mips64 (MIPS64 BE), and mips64el (MIPS64 LE) on Linux.
15+
1316
## [0.8.5] 2022-06-06
1417
### Changed
1518
- Fixed the partial integer parser to correctly return negative values if parsing partial input.

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,6 @@ lexical-core is tested on a wide variety of platforms, including big and small-e
319319
- aarch64 (ARM8v8-A) Linux, Android, and iOS.
320320
- armv7 (ARMv7-A) Linux, Android, and iOS.
321321
- arm (ARMv6) Linux, and Android.
322-
- mips (MIPS) Linux.
323-
- mipsel (MIPS LE) Linux.
324-
- mips64 (MIPS64 BE) Linux.
325-
- mips64el (MIPS64 LE) Linux.
326322
- powerpc (PowerPC) Linux.
327323
- powerpc64 (PPC64) Linux.
328324
- powerpc64le (PPC64LE) Linux.

ci/check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -ex
55

66
# Change to our project home.
7-
script_dir=`dirname "${BASH_SOURCE[0]}"`
7+
script_dir=$(dirname "${BASH_SOURCE[0]}")
88
cd "$script_dir"/..
99

1010
scripts/check.sh

ci/comprehensive.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
# shellcheck disable=SC2086,SC2236
23
# Run a small subset of our comprehensive test suite.
34

45
set -ex
@@ -7,8 +8,8 @@ set -ex
78
cargo --version
89

910
# Change to our project home.
10-
script_dir=`dirname "${BASH_SOURCE[0]}"`
11-
script_home=`realpath "$script_dir"`
11+
script_dir=$(dirname "${BASH_SOURCE[0]}")
12+
script_home=$(realpath "$script_dir")
1213
cd "$script_home"/..
1314

1415
FEATURES=

ci/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
2+
# shellcheck disable=SC2086,SC2236
23
# Run main test suite.
34

45
set -ex
56

67
# Change to our project home.
7-
script_dir=`dirname "${BASH_SOURCE[0]}"`
8+
script_dir=$(dirname "${BASH_SOURCE[0]}")
89
cd "$script_dir"/..
910

1011
# Print our cargo version, for debugging.

docs/Development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In addition, the following non-Rust dependencies must be installed:
5959

6060
# Development Process
6161

62-
The [scripts](https://github.com/Alexhuszagh/rust-lexical/tree/main/scripts) directory contains numerous scripts for testing, fuzzing, analyzing, and formatting code. Since many development features are nightly-only, this ensures the proper compiler features are used. This requires a recent version of a nightly compiler (1.51.0+) installed via Rustup, which can be invoked as `cargo +nightly`.
62+
The [scripts](https://github.com/Alexhuszagh/rust-lexical/tree/main/scripts) directory contains numerous scripts for testing, fuzzing, analyzing, and formatting code. Since many development features are nightly-only, this ensures the proper compiler features are used. This requires a recent version of a nightly compiler (1.65.0+) installed via Rustup, which can be invoked as `cargo +nightly`.
6363

6464
- [asm.sh](https://github.com/Alexhuszagh/rust-lexical/blob/main/scripts/asm.sh): Emit assembly for numeric conversion routines, to identify performance regression.
6565
- [bench.sh](https://github.com/Alexhuszagh/rust-lexical/blob/main/scripts/bench.sh): Check the benchmarks compile and run.
@@ -82,7 +82,7 @@ All PRs must pass the following checks:
8282
RUSTFLAGS="--deny warnings" cargo +nightly build --features=lint
8383
# Ensure all rustfmt and clippy checks pass.
8484
scripts/check.sh
85-
# Ensure all tests pass with common feature combinations.
85+
# Ensure all tests pass with common feature combinations.
8686
# Miri is too slow, so skip those tests for most commits.
8787
SKIP_MIRI=1 scripts/test.sh
8888
```

lexical-asm/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ pub struct ParseIntError {
8383
pub kind: IntErrorKind,
8484
}
8585

86+
#[allow(dead_code)]
8687
trait FromStrRadixHelper: PartialOrd + Copy {
8788
fn min_value() -> Self;
8889
fn max_value() -> Self;

lexical-benchmark/algorithm/Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ default-features = false
1616
features = []
1717

1818
[dev-dependencies]
19-
criterion = { version = "0.3", features = ["html_reports"] }
20-
fastrand = "1.4"
19+
criterion = { version = "0.5.0", features = ["html_reports"] }
20+
fastrand = "2.1.0"
21+
serde = { version = "1.0", features = ["derive"] }
22+
serde_json = "1.0"
2123

2224
[features]
23-
default = ["std", "integers"]
25+
default = ["std", "integers", "floats", "json"]
2426
std = ["lexical-util/std", "lexical-parse-float/std"]
25-
integers = []
27+
integers = ["lexical-util/integers"]
28+
floats = ["lexical-util/floats"]
29+
json = []
2630

2731
[[bench]]
2832
name = "bigint"

lexical-benchmark/algorithm/bigint.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn karatsuba_mul_algo(big: &mut bigint::Bigint, y: &[bigint::Limb]) {
187187
// GENERATOR
188188

189189
#[inline(always)]
190-
fn new_limb(rng: &Rng) -> bigint::Limb {
190+
fn new_limb(rng: &mut Rng) -> bigint::Limb {
191191
if bigint::LIMB_BITS == 32 {
192192
rng.u32(..) as bigint::Limb
193193
} else {
@@ -200,10 +200,10 @@ macro_rules! generator {
200200
$group.bench_function($name, |bench| {
201201
let mut big = bigint::Bigint::new();
202202
let seed = fastrand::u64(..);
203-
let rng = Rng::with_seed(seed);
203+
let mut rng = Rng::with_seed(seed);
204204
bench.iter(|| {
205205
unsafe { big.data.set_len(0) };
206-
big.data.try_push(new_limb(&rng)).unwrap();
206+
big.data.try_push(new_limb(&mut rng)).unwrap();
207207
// Don't go any higher than 300.
208208
$cb(&mut big, rng.u32(1..300));
209209
black_box(&big);
@@ -220,18 +220,18 @@ macro_rules! generator {
220220
$group.bench_function($name, |bench| {
221221
let mut big = bigint::Bigint::new();
222222
let seed = fastrand::u64(..);
223-
let rng = Rng::with_seed(seed);
223+
let mut rng = Rng::with_seed(seed);
224224
bench.iter(|| {
225225
unsafe { big.data.set_len(0) };
226226
// Don't go higher than 20, since we a minimum of 60 limbs.
227227
let count = rng.usize(1..20);
228228
for _ in 0..count {
229-
big.data.try_push(new_limb(&rng)).unwrap();
229+
big.data.try_push(new_limb(&mut rng)).unwrap();
230230
}
231231
let count = rng.usize(1..20);
232232
let mut vec: Vec<bigint::Limb> = Vec::new();
233233
for _ in 0..count {
234-
vec.push(new_limb(&rng));
234+
vec.push(new_limb(&mut rng));
235235
}
236236

237237
// Don't go any higher than 300.

lexical-benchmark/algorithm/division.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn fast_div(v: u32) -> (u32, u32) {
3535
let max_precision = 14;
3636
let additional_precision = 5;
3737

38-
let left_end = (((1 << (max_precision + additional_precision)) + divisor - 1) / divisor) as u32;
38+
let left_end = ((1 << (max_precision + additional_precision)) + divisor - 1) / divisor;
3939
let quotient = (v.wrapping_mul(left_end)) >> (max_precision + additional_precision);
4040
let remainder = v - divisor * quotient;
4141

lexical-benchmark/input.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,12 @@ macro_rules! to_lexical_generator {
395395

396396
macro_rules! dtoa_generator {
397397
($group:ident, $name:expr, $iter:expr) => {{
398-
use lexical_util::constants::BUFFER_SIZE;
399-
let mut buffer = vec![b'0'; BUFFER_SIZE];
398+
let mut buffer = dtoa::Buffer::new();
400399
$group.bench_function($name, |bench| {
401400
bench.iter(|| {
402401
$iter.for_each(|x| {
403-
dtoa::write(&mut buffer, *x).unwrap();
402+
dtoa::format(&mut buffer, *x).unwrap();
404403
black_box(&buffer);
405-
unsafe {
406-
buffer.set_len(0);
407-
} // Way faster than Vec::clear().
408404
})
409405
})
410406
});
@@ -502,7 +498,8 @@ macro_rules! parse_integer_generator {
502498
macro_rules! write_float_generator {
503499
($group:ident, $type:expr, $iter:expr, $fmt:ident) => {{
504500
to_lexical_generator!($group, concat!("write_", $type, "_lexical"), $iter);
505-
dtoa_generator!($group, concat!("write_", $type, "_dtoa"), $iter);
501+
// FIXME: Restore dtoa format later
502+
//dtoa_generator!($group, concat!("write_", $type, "_dtoa"), $iter);
506503
ryu_generator!($group, concat!("write_", $type, "_ryu"), $iter, $fmt);
507504
fmt_generator!($group, concat!("write_", $type, "_fmt"), $iter);
508505
}};

lexical-benchmark/parse-float/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ default-features = false
1616
features = []
1717

1818
[dev-dependencies]
19-
criterion = { version = "0.3", features = ["html_reports"] }
20-
fastrand = "1.4"
19+
criterion = { version = "0.5", features = ["html_reports"] }
20+
fastrand = "2.1.0"
2121
lazy_static = "1"
2222
serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"
@@ -30,7 +30,9 @@ power-of-two = ["lexical-util/power-of-two", "lexical-parse-float/power-of-two"]
3030
format = ["lexical-util/format", "lexical-parse-float/format"]
3131
compact = ["lexical-util/compact", "lexical-parse-float/compact"]
3232
asm = []
33-
floats = []
33+
nightly = ["lexical-parse-float/nightly"]
34+
integers = ["lexical-util/integers"]
35+
floats = ["lexical-util/floats"]
3436
json = []
3537

3638
[[bench]]

lexical-benchmark/parse-float/black_box.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn black_box(mut dummy: f64) -> f64 {
1515

1616
// Optimized black box using the nicer assembly syntax.
1717
#[cfg(not(feature = "asm"))]
18+
#[allow(forgetting_copy_types)]
1819
pub fn black_box(dummy: f64) -> f64 {
1920
unsafe {
2021
let x = core::ptr::read_volatile(&dummy);

0 commit comments

Comments
 (0)