Skip to content

Commit 35e20c2

Browse files
committed
Don't use std for small strings if avx512 is compile-time selected.
1 parent ffd4253 commit 35e20c2

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/implementation/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub(crate) mod portable;
9999

100100
// fallback method implementations
101101
#[inline]
102+
#[allow(dead_code)] // unused if AVX512 is selected at compile-time
102103
pub(crate) fn validate_utf8_basic_fallback(input: &[u8]) -> Result<(), crate::basic::Utf8Error> {
103104
match core::str::from_utf8(input) {
104105
Ok(_) => Ok(()),
@@ -107,6 +108,7 @@ pub(crate) fn validate_utf8_basic_fallback(input: &[u8]) -> Result<(), crate::ba
107108
}
108109

109110
#[inline]
111+
#[allow(dead_code)] // unused if AVX512 is selected at compile-time
110112
pub(crate) fn validate_utf8_compat_fallback(input: &[u8]) -> Result<(), crate::compat::Utf8Error> {
111113
// SAFETY: 0 is always in bounds
112114
unsafe { helpers::validate_utf8_at_offset(input, 0) }

src/implementation/x86/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ pub(crate) unsafe fn validate_utf8_basic(
156156
pub(crate) unsafe fn validate_utf8_basic(
157157
input: &[u8],
158158
) -> core::result::Result<(), crate::basic::Utf8Error> {
159-
if input.len() < super::helpers::SIMD_CHUNK_SIZE {
160-
return super::validate_utf8_basic_fallback(input);
161-
}
162-
163159
validate_utf8_basic_avx512(input)
164160
}
165161

@@ -363,10 +359,6 @@ pub(crate) unsafe fn validate_utf8_compat(
363359
pub(crate) unsafe fn validate_utf8_compat(
364360
input: &[u8],
365361
) -> core::result::Result<(), crate::compat::Utf8Error> {
366-
if input.len() < super::helpers::SIMD_CHUNK_SIZE {
367-
return super::validate_utf8_compat_fallback(input);
368-
}
369-
370362
validate_utf8_compat_avx512(input)
371363
}
372364

0 commit comments

Comments
 (0)