Skip to content

Commit

Permalink
add this Arc<> back to fix perf regression
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Oct 17, 2024
1 parent 4c40c49 commit a4363ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use thiserror::Error;
use odht::HashTableOwned;
use crate::rollhash::{roll_hash, roll_hash_slice};
use crate::corebpe::Rank;
use std::sync::Arc;

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

// TODO: make a non-generic encoding error here
Expand Down Expand Up @@ -121,7 +122,7 @@ impl Encoding {
prefixes_of_mergeable_ranks,
special_tokens,
max_token_value,
core_bpe: core_bpe,
core_bpe: Arc::new(core_bpe),
})
}

Expand Down

0 comments on commit a4363ff

Please sign in to comment.