Skip to content

Commit

Permalink
bump derivre; add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Sep 4, 2024
1 parent 7cf3fac commit 14c4e9c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
toktrie = { git = "https://github.com/microsoft/toktrie", rev = "7cb20cd594428f5397f6159115d5e070e8c0935f" }
derivre = { git = "https://github.com/microsoft/derivre", rev = "9bf0f4842b012b963812a6099acf2cb86406adb2" }
derivre = { git = "https://github.com/microsoft/derivre", rev = "677799cfa3abb1a33928d40f81972b3a9c965e4f" }
serde = { version = "1.0.192", features = ["derive"] }
serde_json = "1.0.108"
anyhow = "1.0.75"
Expand Down
8 changes: 7 additions & 1 deletion parser/src/earley/regexvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ impl RegexVec {
lexeme_idx: usize,
mut budget: u64,
) -> Result<bool> {
let budget0 = budget;
let t0 = instant::Instant::now();
assert!(self.subsume_possible(state));
let small = self.rx_list[lexeme_idx];
self.set_fuel(u64::MAX);
Expand All @@ -142,13 +144,17 @@ impl RegexVec {
let c0 = self.exprs.cost();
let not_contained =
self.relevance
.is_relevant_limited(&mut self.exprs, check, budget)?;
.is_non_empty_limited(&mut self.exprs, check, budget)?;
if !not_contained {
return Ok(true);
}
let cost = self.exprs.cost() - c0;
budget = budget.saturating_sub(cost);
}
let cost = budget0 - budget;
if false && cost > 10 {
println!("check_subsume: {}/{} {:?}", cost, budget0, t0.elapsed());
}
Ok(false)
}

Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14c4e9c

Please sign in to comment.