From 8408ff3b56d54bdd7d878ecad42b1f5402577c85 Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Tue, 25 Jan 2022 18:21:32 -0500 Subject: [PATCH 1/4] enable simpler header name parser in debug builds --- src/header/name.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/header/name.rs b/src/header/name.rs index eb17a423..261276a9 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -1039,7 +1039,7 @@ const HEADER_CHARS_H2: [u8; 256] = [ 0, 0, 0, 0, 0, 0 // 25x ]; -#[cfg(any(not(debug_assertions), not(target_arch = "wasm32")))] +#[cfg(all(not(debug_assertions), not(target_arch = "wasm32")))] macro_rules! eq { (($($cmp:expr,)*) $v:ident[$n:expr] ==) => { $($cmp) && * @@ -1055,7 +1055,7 @@ macro_rules! eq { }; } -#[cfg(any(not(debug_assertions), not(target_arch = "wasm32")))] +#[cfg(all(not(debug_assertions), not(target_arch = "wasm32")))] /// This version is best under optimized mode, however in a wasm debug compile, /// the `eq` macro expands to 1 + 1 + 1 + 1... and wasm explodes when this chain gets too long /// See https://github.com/DenisKolodin/yew/issues/478 @@ -1518,7 +1518,7 @@ fn parse_hdr<'a>( } } -#[cfg(all(debug_assertions, target_arch = "wasm32"))] +#[cfg(any(debug_assertions, target_arch = "wasm32"))] /// This version works best in debug mode in wasm fn parse_hdr<'a>( data: &'a [u8], From 9289c630de78c64fbfa79690407591ac9ba81fd7 Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Tue, 25 Jan 2022 18:24:50 -0500 Subject: [PATCH 2/4] test on release mode in ci --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b5bf748..3c02eaf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,12 @@ jobs: uses: actions-rs/cargo@v1 with: command: test + + - name: Test Release + uses: actions-rs/cargo@v1 + with: + command: test + args: --release - name: Test all benches if: matrix.benches From c3f6c144fb264052f0f76d1eec84f1d2c1bc96a3 Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Tue, 25 Jan 2022 20:17:01 -0500 Subject: [PATCH 3/4] simplify cfg flags --- src/header/name.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/header/name.rs b/src/header/name.rs index 261276a9..85f5c7a9 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -1039,7 +1039,7 @@ const HEADER_CHARS_H2: [u8; 256] = [ 0, 0, 0, 0, 0, 0 // 25x ]; -#[cfg(all(not(debug_assertions), not(target_arch = "wasm32")))] +#[cfg(not(debug_assertions))] macro_rules! eq { (($($cmp:expr,)*) $v:ident[$n:expr] ==) => { $($cmp) && * @@ -1055,7 +1055,7 @@ macro_rules! eq { }; } -#[cfg(all(not(debug_assertions), not(target_arch = "wasm32")))] +#[cfg(not(debug_assertions))] /// This version is best under optimized mode, however in a wasm debug compile, /// the `eq` macro expands to 1 + 1 + 1 + 1... and wasm explodes when this chain gets too long /// See https://github.com/DenisKolodin/yew/issues/478 @@ -1518,7 +1518,7 @@ fn parse_hdr<'a>( } } -#[cfg(any(debug_assertions, target_arch = "wasm32"))] +#[cfg(debug_assertions)] /// This version works best in debug mode in wasm fn parse_hdr<'a>( data: &'a [u8], From a55e07b7d40c46b9591a9396bd1499f3a7375948 Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Tue, 25 Jan 2022 20:26:05 -0500 Subject: [PATCH 4/4] update docs --- src/header/name.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/header/name.rs b/src/header/name.rs index 85f5c7a9..718d27eb 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -1056,9 +1056,8 @@ macro_rules! eq { } #[cfg(not(debug_assertions))] -/// This version is best under optimized mode, however in a wasm debug compile, -/// the `eq` macro expands to 1 + 1 + 1 + 1... and wasm explodes when this chain gets too long -/// See https://github.com/DenisKolodin/yew/issues/478 +/// This version is best under optimized mode, however it generates a lot of +/// code that adds ~1s to build times, so we only compile it for release builds. fn parse_hdr<'a>( data: &'a [u8], b: &'a mut [u8; 64], @@ -1519,7 +1518,7 @@ fn parse_hdr<'a>( } #[cfg(debug_assertions)] -/// This version works best in debug mode in wasm +/// This version compiles faster for debug builds fn parse_hdr<'a>( data: &'a [u8], b: &'a mut [u8; 64],