Skip to content

Commit 33da962

Browse files
committed
optimize more
1 parent 0d6bf1d commit 33da962

File tree

3 files changed

+465
-209
lines changed

3 files changed

+465
-209
lines changed

src/avx2.rs

Lines changed: 0 additions & 190 deletions
This file was deleted.

src/lib.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
#![cfg_attr(feature = "nightly", feature(test))]
22

33
#[cfg(target_arch = "x86_64")]
4-
pub use x86_64::encode_str;
4+
pub use x86::encode_str;
55

66
#[cfg(target_arch = "x86_64")]
7-
mod avx2;
8-
9-
#[cfg(target_arch = "x86_64")]
10-
mod x86_64 {
11-
#[inline]
12-
pub fn encode_str<S: AsRef<str>>(input: S) -> String {
13-
// Runtime CPU feature detection for AVX2
14-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
15-
{
16-
if is_x86_feature_detected!("avx2") {
17-
return crate::avx2::encode_str(input);
18-
}
19-
}
20-
21-
// Fallback to optimized non-SIMD implementation
22-
crate::encode_str_fallback(input)
23-
}
24-
}
7+
mod x86;
258

269
const BB: u8 = b'b'; // \x08
2710
const TT: u8 = b't'; // \x09

0 commit comments

Comments
 (0)