From 635ea464f4582963963604175d48d58e06ae6fd4 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 24 Jan 2024 03:46:03 +0000 Subject: [PATCH 1/3] perf: remove unnecessary allocation when writing http dates --- .github/workflows/ci.yml | 2 ++ actix-http/Cargo.toml | 5 +++++ actix-http/benches/date-formatting.rs | 20 ++++++++++++++++++++ actix-http/src/date.rs | 2 +- actix-http/src/header/shared/http_date.rs | 5 ++--- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 actix-http/benches/date-formatting.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dcd8fab934..7d4d1a4b286 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,8 @@ jobs: - name: workaround MSRV issues if: matrix.version.name == 'msrv' run: | + cargo update -p=ciborium --precise=0.2.1 + cargo update -p=ciborium-ll --precise=0.2.1 cargo update -p=clap --precise=4.3.24 cargo update -p=clap_lex --precise=0.5.0 cargo update -p=anstyle --precise=1.0.2 diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 6c53f35cc9e..aa243b04bd0 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -113,6 +113,7 @@ actix-web = "4" async-stream = "0.3" criterion = { version = "0.5", features = ["html_reports"] } +divan = "0.1.8" env_logger = "0.10" futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] } memchr = "2.4" @@ -140,3 +141,7 @@ required-features = ["http2", "rustls-0_21"] name = "response-body-compression" harness = false required-features = ["compress-brotli", "compress-gzip", "compress-zstd"] + +[[bench]] +name = "date-formatting" +harness = false diff --git a/actix-http/benches/date-formatting.rs b/actix-http/benches/date-formatting.rs new file mode 100644 index 00000000000..26d0f3daac9 --- /dev/null +++ b/actix-http/benches/date-formatting.rs @@ -0,0 +1,20 @@ +use std::time::SystemTime; + +use actix_http::header::HttpDate; +use divan::{black_box, AllocProfiler, Bencher}; + +#[global_allocator] +static ALLOC: AllocProfiler = AllocProfiler::system(); + +#[divan::bench] +fn date_formatting(b: Bencher<'_, '_>) { + let now = SystemTime::now(); + + b.bench(|| { + black_box(HttpDate::from(black_box(now)).to_string()); + }) +} + +fn main() { + divan::main(); +} diff --git a/actix-http/src/date.rs b/actix-http/src/date.rs index 1358bbd8c3f..735dd91004d 100644 --- a/actix-http/src/date.rs +++ b/actix-http/src/date.rs @@ -28,7 +28,7 @@ impl Date { fn update(&mut self) { self.pos = 0; - write!(self, "{}", httpdate::fmt_http_date(SystemTime::now())).unwrap(); + write!(self, "{}", httpdate::HttpDate::from(SystemTime::now())).unwrap(); } } diff --git a/actix-http/src/header/shared/http_date.rs b/actix-http/src/header/shared/http_date.rs index 21ed49f0cc6..bdfbc7051da 100644 --- a/actix-http/src/header/shared/http_date.rs +++ b/actix-http/src/header/shared/http_date.rs @@ -24,8 +24,7 @@ impl FromStr for HttpDate { impl fmt::Display for HttpDate { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let date_str = httpdate::fmt_http_date(self.0); - f.write_str(&date_str) + httpdate::HttpDate::from(self.0).fmt(f) } } @@ -37,7 +36,7 @@ impl TryIntoHeaderValue for HttpDate { let mut wrt = MutWriter(&mut buf); // unwrap: date output is known to be well formed and of known length - write!(wrt, "{}", httpdate::fmt_http_date(self.0)).unwrap(); + write!(wrt, "{}", self).unwrap(); HeaderValue::from_maybe_shared(buf.split().freeze()) } From e3f08e551b01102697f58504b5280ce8433e28bd Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 7 Feb 2024 03:14:34 +0000 Subject: [PATCH 2/3] chore: msrv 1.70 --- .github/workflows/ci.yml | 2 +- Cargo.toml | 2 +- actix-files/CHANGES.md | 2 ++ actix-files/README.md | 2 +- actix-http-test/CHANGES.md | 2 ++ actix-http-test/README.md | 7 +------ actix-http/CHANGES.md | 4 ++++ actix-http/README.md | 7 +------ actix-multipart-derive/CHANGES.md | 2 ++ actix-multipart-derive/README.md | 7 +------ actix-multipart-derive/tests/trybuild.rs | 2 +- actix-multipart/CHANGES.md | 2 ++ actix-multipart/README.md | 7 +------ actix-router/CHANGES.md | 2 ++ actix-router/README.md | 2 +- actix-test/CHANGES.md | 2 ++ actix-web-actors/CHANGES.md | 2 ++ actix-web-actors/README.md | 7 +------ actix-web-codegen/CHANGES.md | 2 ++ actix-web-codegen/README.md | 7 +------ actix-web-codegen/tests/trybuild.rs | 2 +- actix-web/CHANGES.md | 4 ++++ actix-web/README.md | 4 ++-- awc/CHANGES.md | 2 ++ awc/README.md | 8 +++----- 25 files changed, 43 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9af6d75f99c..b0f56d87b99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - { name: macOS, os: macos-latest, triple: x86_64-apple-darwin } - { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc } version: - - { name: msrv, version: 1.68.0 } + - { name: msrv, version: 1.70.0 } - { name: stable, version: stable } name: ${{ matrix.target.name }} / ${{ matrix.version.name }} diff --git a/Cargo.toml b/Cargo.toml index 58fd96935a2..f90cdbeabf6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ members = [ [workspace.package] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.68" +rust-version = "1.70" [profile.dev] # Disabling debug info speeds up builds a bunch and we don't rely on it for debugging that much. diff --git a/actix-files/CHANGES.md b/actix-files/CHANGES.md index 9aa62ff778f..0099dcf3567 100644 --- a/actix-files/CHANGES.md +++ b/actix-files/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 0.6.5 - Fix handling of special characters in filenames. diff --git a/actix-files/README.md b/actix-files/README.md index df80e4047bb..1f05be18682 100644 --- a/actix-files/README.md +++ b/actix-files/README.md @@ -4,7 +4,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-files?label=latest)](https://crates.io/crates/actix-files) [![Documentation](https://docs.rs/actix-files/badge.svg?version=0.6.5)](https://docs.rs/actix-files/0.6.5) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![License](https://img.shields.io/crates/l/actix-files.svg)
[![dependency status](https://deps.rs/crate/actix-files/0.6.5/status.svg)](https://deps.rs/crate/actix-files/0.6.5) diff --git a/actix-http-test/CHANGES.md b/actix-http-test/CHANGES.md index ec30b9c4c93..b9b2d9d149e 100644 --- a/actix-http-test/CHANGES.md +++ b/actix-http-test/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 3.2.0 - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. diff --git a/actix-http-test/README.md b/actix-http-test/README.md index 9a87f9ef2a7..6639874d716 100644 --- a/actix-http-test/README.md +++ b/actix-http-test/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-http-test?label=latest)](https://crates.io/crates/actix-http-test) [![Documentation](https://docs.rs/actix-http-test/badge.svg?version=3.2.0)](https://docs.rs/actix-http-test/3.2.0) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-http-test)
[![Dependency Status](https://deps.rs/crate/actix-http-test/3.2.0/status.svg)](https://deps.rs/crate/actix-http-test/3.2.0) @@ -14,8 +14,3 @@ [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) - -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-http-test) -- Minimum Supported Rust Version (MSRV): 1.68 diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index e3805ff7e26..a50bb906790 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +- Minimum supported Rust version (MSRV) is now 1.70. + ## 3.6.0 ### Added diff --git a/actix-http/README.md b/actix-http/README.md index c9bd1b34cc7..4f10ba2415f 100644 --- a/actix-http/README.md +++ b/actix-http/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-http?label=latest)](https://crates.io/crates/actix-http) [![Documentation](https://docs.rs/actix-http/badge.svg?version=3.6.0)](https://docs.rs/actix-http/3.6.0) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-http.svg)
[![dependency status](https://deps.rs/crate/actix-http/3.6.0/status.svg)](https://deps.rs/crate/actix-http/3.6.0) @@ -15,11 +15,6 @@ -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-http) -- Minimum Supported Rust Version (MSRV): 1.68 - ## Examples ```rust diff --git a/actix-multipart-derive/CHANGES.md b/actix-multipart-derive/CHANGES.md index e36a13d04e6..23dd4f2dfe4 100644 --- a/actix-multipart-derive/CHANGES.md +++ b/actix-multipart-derive/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 0.6.1 - Update `syn` dependency to `2`. diff --git a/actix-multipart-derive/README.md b/actix-multipart-derive/README.md index 2beadefe33b..6845e9dfbb7 100644 --- a/actix-multipart-derive/README.md +++ b/actix-multipart-derive/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-multipart-derive?label=latest)](https://crates.io/crates/actix-multipart-derive) [![Documentation](https://docs.rs/actix-multipart-derive/badge.svg?version=0.6.1)](https://docs.rs/actix-multipart-derive/0.6.1) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-multipart-derive.svg)
[![dependency status](https://deps.rs/crate/actix-multipart-derive/0.6.1/status.svg)](https://deps.rs/crate/actix-multipart-derive/0.6.1) @@ -14,8 +14,3 @@ [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) - -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-multipart-derive) -- Minimum Supported Rust Version (MSRV): 1.68 diff --git a/actix-multipart-derive/tests/trybuild.rs b/actix-multipart-derive/tests/trybuild.rs index 88aa619c6ff..b196868a71b 100644 --- a/actix-multipart-derive/tests/trybuild.rs +++ b/actix-multipart-derive/tests/trybuild.rs @@ -1,4 +1,4 @@ -#[rustversion::stable(1.68)] // MSRV +#[rustversion::stable(1.70)] // MSRV #[test] fn compile_macros() { let t = trybuild::TestCases::new(); diff --git a/actix-multipart/CHANGES.md b/actix-multipart/CHANGES.md index 50faf7cfafc..214f899e031 100644 --- a/actix-multipart/CHANGES.md +++ b/actix-multipart/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 0.6.1 - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. diff --git a/actix-multipart/README.md b/actix-multipart/README.md index 16068510ea4..15a701751b4 100644 --- a/actix-multipart/README.md +++ b/actix-multipart/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-multipart?label=latest)](https://crates.io/crates/actix-multipart) [![Documentation](https://docs.rs/actix-multipart/badge.svg?version=0.6.1)](https://docs.rs/actix-multipart/0.6.1) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-multipart.svg)
[![dependency status](https://deps.rs/crate/actix-multipart/0.6.1/status.svg)](https://deps.rs/crate/actix-multipart/0.6.1) @@ -14,8 +14,3 @@ [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) - -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-multipart) -- Minimum Supported Rust Version (MSRV): 1.68 diff --git a/actix-router/CHANGES.md b/actix-router/CHANGES.md index a855c0074bc..4d77988d130 100644 --- a/actix-router/CHANGES.md +++ b/actix-router/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 0.5.2 - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. diff --git a/actix-router/README.md b/actix-router/README.md index 7760b03315d..506b6501676 100644 --- a/actix-router/README.md +++ b/actix-router/README.md @@ -4,7 +4,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-router?label=latest)](https://crates.io/crates/actix-router) [![Documentation](https://docs.rs/actix-router/badge.svg?version=0.5.2)](https://docs.rs/actix-router/0.5.2) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-router.svg)
[![dependency status](https://deps.rs/crate/actix-router/0.5.2/status.svg)](https://deps.rs/crate/actix-router/0.5.2) diff --git a/actix-test/CHANGES.md b/actix-test/CHANGES.md index 8604a1265d0..99bb21edcac 100644 --- a/actix-test/CHANGES.md +++ b/actix-test/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 0.1.3 - Add `TestServerConfig::rustls_0_22()` method for Rustls v0.22 support behind new `rustls-0_22` crate feature. diff --git a/actix-web-actors/CHANGES.md b/actix-web-actors/CHANGES.md index 85d6b624ae0..c146841f5af 100644 --- a/actix-web-actors/CHANGES.md +++ b/actix-web-actors/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 4.3.0 - Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency. diff --git a/actix-web-actors/README.md b/actix-web-actors/README.md index 17b94722333..202d7d4c9d4 100644 --- a/actix-web-actors/README.md +++ b/actix-web-actors/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-web-actors?label=latest)](https://crates.io/crates/actix-web-actors) [![Documentation](https://docs.rs/actix-web-actors/badge.svg?version=4.3.0)](https://docs.rs/actix-web-actors/4.3.0) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![License](https://img.shields.io/crates/l/actix-web-actors.svg)
[![dependency status](https://deps.rs/crate/actix-web-actors/4.3.0/status.svg)](https://deps.rs/crate/actix-web-actors/4.3.0) @@ -14,8 +14,3 @@ [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) - -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-web-actors) -- Minimum Supported Rust Version (MSRV): 1.68 diff --git a/actix-web-codegen/CHANGES.md b/actix-web-codegen/CHANGES.md index 00e36b037a7..ecab6e094b8 100644 --- a/actix-web-codegen/CHANGES.md +++ b/actix-web-codegen/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 4.2.2 - Fix regression when declaring `wrap` attribute using an expression. diff --git a/actix-web-codegen/README.md b/actix-web-codegen/README.md index 088f3575698..bd79f9afb98 100644 --- a/actix-web-codegen/README.md +++ b/actix-web-codegen/README.md @@ -6,7 +6,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-web-codegen?label=latest)](https://crates.io/crates/actix-web-codegen) [![Documentation](https://docs.rs/actix-web-codegen/badge.svg?version=4.2.2)](https://docs.rs/actix-web-codegen/4.2.2) -![Version](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![Version](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![License](https://img.shields.io/crates/l/actix-web-codegen.svg)
[![dependency status](https://deps.rs/crate/actix-web-codegen/4.2.2/status.svg)](https://deps.rs/crate/actix-web-codegen/4.2.2) @@ -15,11 +15,6 @@ -## Documentation & Resources - -- [API Documentation](https://docs.rs/actix-web-codegen) -- Minimum Supported Rust Version (MSRV): 1.68 - ## Compile Testing Uses the [`trybuild`] crate. All compile fail tests should include a stderr file generated by `trybuild`. See the [workflow section](https://github.com/dtolnay/trybuild#workflow) of the trybuild docs for info on how to do this. diff --git a/actix-web-codegen/tests/trybuild.rs b/actix-web-codegen/tests/trybuild.rs index 8e1f58a4c58..13b0359f3d7 100644 --- a/actix-web-codegen/tests/trybuild.rs +++ b/actix-web-codegen/tests/trybuild.rs @@ -1,4 +1,4 @@ -#[rustversion::stable(1.68)] // MSRV +#[rustversion::stable(1.70)] // MSRV #[test] fn compile_macros() { let t = trybuild::TestCases::new(); diff --git a/actix-web/CHANGES.md b/actix-web/CHANGES.md index 6e2894e40eb..d296e334537 100644 --- a/actix-web/CHANGES.md +++ b/actix-web/CHANGES.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +- Minimum supported Rust version (MSRV) is now 1.70. + ## 4.5.1 ### Fixed diff --git a/actix-web/README.md b/actix-web/README.md index b564c8793c7..613f7e04e33 100644 --- a/actix-web/README.md +++ b/actix-web/README.md @@ -9,7 +9,7 @@ [![crates.io](https://img.shields.io/crates/v/actix-web?label=latest)](https://crates.io/crates/actix-web) [![Documentation](https://docs.rs/actix-web/badge.svg?version=4.5.1)](https://docs.rs/actix-web/4.5.1) -![MSRV](https://img.shields.io/badge/rustc-1.68+-ab6000.svg) +![MSRV](https://img.shields.io/badge/rustc-1.70+-ab6000.svg) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg) [![Dependency Status](https://deps.rs/crate/actix-web/4.5.1/status.svg)](https://deps.rs/crate/actix-web/4.5.1)
@@ -37,7 +37,7 @@ - SSL support using OpenSSL or Rustls - Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/)) - Integrates with the [`awc` HTTP client](https://docs.rs/awc/) -- Runs on stable Rust 1.68+ +- Runs on stable Rust 1.70+ ## Documentation diff --git a/awc/CHANGES.md b/awc/CHANGES.md index 4ed02ada6d7..769f896a8ff 100644 --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -2,6 +2,8 @@ ## Unreleased +- Minimum supported Rust version (MSRV) is now 1.70. + ## 3.4.0 - Add `rustls-0_22-webpki-roots` and `rustls-0_22-native-roots` crate feature. diff --git a/awc/README.md b/awc/README.md index d86657564eb..19236b85abd 100644 --- a/awc/README.md +++ b/awc/README.md @@ -12,13 +12,11 @@ -## Documentation & Resources +## Examples -- [API Documentation](https://docs.rs/awc) -- [Example Project](https://github.com/actix/examples/tree/master/https-tls/awc-https) -- Minimum Supported Rust Version (MSRV): 1.68 +[Example project using TLS-enabled client →](https://github.com/actix/examples/tree/master/https-tls/awc-https) -## Example +Basic usage: ```rust use actix_rt::System; From ebc813a3622dc70556978713029f85fe52abeeff Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 7 Feb 2024 03:27:42 +0000 Subject: [PATCH 3/3] ci: remove msrv workarounds --- .github/workflows/ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0f56d87b99..ee12ebabaad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,14 +54,10 @@ jobs: with: tool: cargo-hack,cargo-ci-cache-clean - - name: workaround MSRV issues - if: matrix.version.name == 'msrv' - run: | - cargo update -p=ciborium --precise=0.2.1 - cargo update -p=ciborium-ll --precise=0.2.1 - cargo update -p=clap --precise=4.3.24 - cargo update -p=clap_lex --precise=0.5.0 - cargo update -p=anstyle --precise=1.0.2 + # - name: workaround MSRV issues + # if: matrix.version.name == 'msrv' + # run: | + # cargo update -p=anstyle --precise=1.0.2 - name: check minimal run: cargo ci-check-min