Skip to content

Commit a4363ff

Browse files
committed
add this Arc<> back to fix perf regression
1 parent 4c40c49 commit a4363ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/encoding.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use thiserror::Error;
66
use odht::HashTableOwned;
77
use crate::rollhash::{roll_hash, roll_hash_slice};
88
use crate::corebpe::Rank;
9+
use std::sync::Arc;
910

1011
include!("odht.rs");
1112
include!(concat!(env!("OUT_DIR"), "/static.rs"));
@@ -26,7 +27,7 @@ pub struct Encoding {
2627
/// The maximum token value in the encoding.
2728
max_token_value: Rank,
2829
/// The core BPE logic implemented in Rust.
29-
core_bpe: CoreBPE,
30+
core_bpe: Arc<CoreBPE>,
3031
}
3132

3233
// TODO: make a non-generic encoding error here
@@ -121,7 +122,7 @@ impl Encoding {
121122
prefixes_of_mergeable_ranks,
122123
special_tokens,
123124
max_token_value,
124-
core_bpe: core_bpe,
125+
core_bpe: Arc::new(core_bpe),
125126
})
126127
}
127128

0 commit comments

Comments
 (0)