Skip to content

Commit b990542

Browse files
authored
Merge pull request #1875 from Kobzol/benchmark-typenum
Add `typenum-1.17.0` benchmark
2 parents c836192 + f2941e9 commit b990542

30 files changed

+16104
-0
lines changed

collector/compile-benchmarks/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ They mostly consist of real-world crates.
5353
built with `--features=stm32f410` to have faster benchmarking times.
5454
- **syn-1.0.89**: A library for parsing Rust code. An important part of the Rust
5555
ecosystem.
56+
- **typenum-1.17.0**: A library that encodes integer computation within the trait system. Serves as
57+
a stress test for the trait solver, but at the same time it is also a very popular crate.
5658
- **unicode-normalization-0.1.19**: Unicode character composition and decomposition
5759
utilities. Uses huge `match` statements that stress the compiler in unusual
5860
ways.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "b237efbb1da9646435274f63d7290cb7651b031f"
4+
},
5+
"path_in_vcs": ""
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
8+
9+
name: CI
10+
11+
jobs:
12+
all-succeeded:
13+
name: All Succeeded
14+
if: always()
15+
runs-on: ubuntu-latest
16+
needs:
17+
- test-linux
18+
- test-non-linux
19+
- lint
20+
21+
steps:
22+
- name: Check if all jubs succeeded
23+
uses: re-actors/alls-green@release/v1
24+
with:
25+
jobs: ${{ toJSON(needs) }}
26+
27+
test-linux:
28+
name: Test Linux
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
rust:
34+
- stable
35+
- beta
36+
- nightly
37+
mb_const_generics:
38+
- ""
39+
- "--features const-generics"
40+
target:
41+
- x86_64
42+
- i686
43+
- sparc64
44+
include:
45+
- mb_const_generics: ""
46+
rust: 1.37.0
47+
target: x86_64
48+
steps:
49+
- uses: actions/checkout@v3
50+
- uses: dtolnay/rust-toolchain@master
51+
with:
52+
toolchain: ${{ matrix.rust }}
53+
- uses: actions-rs/cargo@v1
54+
with:
55+
use-cross: ${{ matrix.target != 'x86_64' }}
56+
command: test
57+
args: --verbose --features "strict" ${{ matrix.mb_const_generics }} --target ${{ matrix.target }}-unknown-linux-gnu
58+
- uses: actions-rs/cargo@v1
59+
with:
60+
use-cross: ${{ matrix.target != 'x86_64' }}
61+
command: doc
62+
args: --features "strict" ${{ matrix.mb_const_generics }} --target ${{ matrix.target }}-unknown-linux-gnu
63+
64+
test-non-linux:
65+
name: Test non-Linux
66+
runs-on: ${{ matrix.os }}
67+
strategy:
68+
matrix:
69+
os:
70+
- macos-latest
71+
- windows-latest
72+
rust:
73+
- stable
74+
mb_const_generics:
75+
- ""
76+
- "--features const-generics"
77+
steps:
78+
- uses: actions/checkout@v3
79+
- uses: dtolnay/rust-toolchain@master
80+
with:
81+
toolchain: ${{ matrix.rust }}
82+
- run: cargo test --verbose --features "strict" ${{ matrix.mb_const_generics }}
83+
- run: cargo doc --features "strict" ${{ matrix.mb_const_generics }}
84+
85+
lint:
86+
name: Lint
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v3
90+
- uses: dtolnay/rust-toolchain@nightly
91+
with:
92+
components: rustfmt, clippy
93+
- run: cargo fmt --all -- --check
94+
- run: cargo clippy -- -D warnings
95+
# Allow deprecated because we test the no_std feature.
96+
- run: cargo clippy --all-features -- -D warnings -A deprecated
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Publish
7+
8+
jobs:
9+
release:
10+
name: GitHub Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: marvinpinto/action-automatic-releases@latest
15+
with:
16+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
17+
prerelease: false
18+
19+
publish:
20+
name: Crates.io Publish
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: dtolnay/rust-toolchain@stable
25+
- uses: katyo/publish-crates@v1
26+
with:
27+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target
2+
Cargo.lock
3+
4+
*.bk
5+
*\~
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index 7a40b2a0..1992946c 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -196,3 +196,4 @@ mod sealed {
6+
impl Sealed for ATerm {}
7+
impl<V, A> Sealed for TArr<V, A> {}
8+
}
9+
+fn foo() { let a = 5; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Changelog
2+
3+
This project follows semantic versioning.
4+
5+
The MSRV (Minimum Supported Rust Version) is 1.37.0, and typenum is tested
6+
against this Rust version.
7+
8+
### Unreleased
9+
- [removed] Remove `force_unix_path_separator` feature, make it the default
10+
- [added] docs.rs metadata and cfg options
11+
- [added] Playground metadata
12+
13+
### 1.16.0 (2022-12-05)
14+
- [added] `const INT` field to the `ToInt` trait.
15+
- [added] `const-generics` field with `U<N>` mapping where `N` is a const generic.
16+
17+
### 1.15.0 (2021-12-25)
18+
- [fixed] Cross-compilation issue due to doing math in build script. (PR #177)
19+
- [added] New feature `scale_info` for using inside
20+
[Substrate](https://github.com/paritytech/substrate.git)-based runtimes (PR
21+
#175)
22+
23+
### 1.14.0 (2021-09-01)
24+
- [changed] Sealed all marker traits. Documentation already stated that these
25+
should not be implemented outside the crate, so this is not considered a
26+
breaking change.
27+
28+
### 1.13.0 (2021-03-12)
29+
- [changed] MSRV from 1.22.0 to 1.37.0.
30+
- [fixed] `op` macro with 2018 edition import.
31+
- [changed] Allowed calling `assert_type_eq` and `assert_type` at top level.
32+
- [added] Marker trait `Zero` for `Z0`, `U0`, and `B0`.
33+
- [added] Implementation of `Pow` trait for f32 and f64 with negative exponent.
34+
- [added] Trait `ToInt`.
35+
36+
### 1.12.0 (2020-04-13)
37+
- [added] Feature `force_unix_path_separator` to support building without Cargo.
38+
- [added] Greatest common divisor operator `Gcd` with alias `Gcf`.
39+
- [added] `gcd` to the `op!` macro.
40+
- [changed] Added `Copy` bound to `Rhs` of `Mul<Rhs>` impl for `<TArr<V, A>`.
41+
- [changed] Added `Copy` bound to `Rhs` of `Div<Rhs>` impl for `<TArr<V, A>`.
42+
- [changed] Added `Copy` bound to `Rhs` of `PartialDiv<Rhs>` impl for `<TArr<V, A>`.
43+
- [changed] Added `Copy` bound to `Rhs` of `Rem<Rhs>` impl for `<TArr<V, A>`.
44+
- [fixed] Make all functions #[inline].
45+
46+
### 1.11.2 (2019-08-26)
47+
- [fixed] Cross compilation from Linux to Windows.
48+
49+
### 1.11.1 (2019-08-25)
50+
- [fixed] Builds on earlier Rust builds again and added Rust 1.22.0 to Travis to
51+
prevent future breakage.
52+
53+
### 1.11.0 (2019-08-25)
54+
- [added] Integer `log2` to the `op!` macro.
55+
- [added] Integer binary logarithm operator `Logarithm2` with alias `Log2`.
56+
- [changed] Removed `feature(i128_type)` when running with the `i128`
57+
feature. Kept the feature flag. for typenum to maintain compatibility with
58+
old Rust versions.
59+
- [added] Integer `sqrt` to the `op!` macro.
60+
- [added] Integer square root operator `SquareRoot` with alias `Sqrt`.
61+
- [fixed] Bug with attempting to create U1024 type alias twice.
62+
63+
### 1.10.0 (2018-03-11)
64+
- [added] The `PowerOfTwo` marker trait.
65+
- [added] Associated constants for `Bit`, `Unsigned`, and `Integer`.
66+
67+
### 1.9.0 (2017-05-14)
68+
- [added] The `Abs` type operator and corresponding `AbsVal` alias.
69+
- [added] The feature `i128` that enables creating 128-bit integers from
70+
typenums.
71+
- [added] The `assert_type!` and `assert_type_eq!` macros.
72+
- [added] Operators to the `op!` macro, including those performed by `cmp!`.
73+
- [fixed] Bug in `op!` macro involving functions and convoluted expressions.
74+
- [deprecated] The `cmp!` macro.
75+
76+
### 1.8.0 (2017-04-12)
77+
- [added] The `op!` macro for conveniently performing type-level operations.
78+
- [added] The `cmp!` macro for conveniently performing type-level comparisons.
79+
- [added] Some comparison type-operators that are used by the `cmp!` macro.
80+
81+
### 1.7.0 (2017-03-24)
82+
- [added] Type operators `Min` and `Max` with accompanying aliases `Minimum` and
83+
`Maximum`
84+
85+
### 1.6.0 (2017-02-24)
86+
- [fixed] Bug in `Array` division.
87+
- [fixed] Bug where `Rem` would sometimes exit early with the wrong answer.
88+
- [added] `PartialDiv` operator that performs division as a partial function --
89+
it's defined only when there is no remainder.
90+
91+
### 1.5.2 (2017-02-04)
92+
- [fixed] Bug between `Div` implementation and type system.
93+
94+
### 1.5.1 (2016-11-08)
95+
- [fixed] Expanded implementation of `Pow` for primitives.
96+
97+
### 1.5.0 (2016-11-03)
98+
- [added] Functions to the `Pow` and `Len` traits. This is *technically* a
99+
breaking change, but it would only break someone's code if they have a custom
100+
impl for `Pow`. I would be very surprised if that is anyone other than me.
101+
102+
### 1.4.0 (2016-10-29)
103+
- [added] Type-level arrays of type-level integers. (PR #66)
104+
- [added] The types in this crate are now instantiable. (Issue #67, PR #68)
105+
106+
### 1.3.1 (2016-03-31)
107+
- [fixed] Bug with recent nightlies.
108+
109+
### 1.3.0 (2016-02-07)
110+
- [changed] Removed dependency on libstd. (Issue #53, PR #55)
111+
- [changed] Reorganized module structure. (PR #57)
112+
113+
### 1.2.0 (2016-01-03)
114+
- [added] This change log!
115+
- [added] Convenience type aliases for operators. (Issue #48, PR #50)
116+
- [added] Types in this crate now derive all possible traits. (Issue #42, PR
117+
#51)

0 commit comments

Comments
 (0)