Skip to content

Commit d3df915

Browse files
committed
Use SmallVec for the stack in explicit::compute().
1 parent 5a620a6 commit d3df915

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/explicit.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
//!
1212
//! <http://www.unicode.org/reports/tr9/#Explicit_Levels_and_Directions>
1313
14+
#[cfg(feature = "smallvec")]
15+
use smallvec::{SmallVec, smallvec};
16+
1417
use super::char_data::{
1518
is_rtl,
1619
BidiClass::{self, *},
@@ -33,6 +36,12 @@ pub fn compute<'a, T: TextSource<'a> + ?Sized>(
3336
assert_eq!(text.len(), original_classes.len());
3437

3538
// <http://www.unicode.org/reports/tr9/#X1>
39+
#[cfg(feature = "smallvec")]
40+
let mut stack: SmallVec::<[Status; 8]> = smallvec![Status {
41+
level: para_level,
42+
status: OverrideStatus::Neutral,
43+
}];
44+
#[cfg(not(feature = "smallvec"))]
3645
let mut stack = vec![Status {
3746
level: para_level,
3847
status: OverrideStatus::Neutral,

0 commit comments

Comments
 (0)