| 5 | use serde::{Deserialize, Serialize}; |
| 6 | |
| 7 | fn predictor_id() -> [u8; 32] { |
| 8 | let mut h = blake3::Hasher::new(); |
| 9 | h.update(b"lab-ascii-token-length-window4096-v1\0"); |
| 10 | for bytes in [ |
| 11 | include_bytes!("lengths.rs").as_slice(), |
| 12 | include_bytes!("../../src/diff/token/tokenizer.rs").as_slice(), |
| 13 | include_bytes!("../../src/diff/token/config.rs").as_slice(), |
| 14 | include_bytes!("../../src/diff/token/kind.rs").as_slice(), |
| 15 | include_bytes!("../../src/diff/token/token_type.rs").as_slice(), |
| 16 | include_bytes!("../../src/diff/token/mod.rs").as_slice(), |
| 17 | ] { |
| 18 | h.update(&(bytes.len() as u64).to_le_bytes()); |
| 19 | h.update(bytes); |
| 20 | } |
| 21 | *h.finalize().as_bytes() |
| 22 | } |
| 23 | fn predict(bytes: &[u8]) -> usize { |
| 24 | let cap = bytes.len().min(4096); |
| 25 | let mut width = cap.min(16); |