commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
e453f6062651f338ca3a7fb217f7590a2f89f9ab | Andrew Gallant | 2023-01-05T03:59:24 | fuzz: fix a bug caught by the fuzzer
I'm not sure why this wasn't caught in the old API, as I think the same
bug existed. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 8a6a6aa..e6f06e6 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -687,6 +687,9 @@ impl AhoCorasick {
/// (if any). If the closure returns `true`, then it continues to the next
/// match. If the closure returns `false`, then searching is st... | 2 | 17 | 0 |
5b9b090fdcef9882cff92ba7c65cbe6befe68ac9 | Andrew Gallant | 2022-12-01T01:16:03 | impl: get rid of 'depth' on 'State'
Now that we've greatly simplified leftmost NFA construction, we no
longer need to record the depth of a state. (We do still use it to
determine whether to build a sparse or a dense state, though, that
doesn't require storing the depth.) | diff --git a/src/nfa.rs b/src/nfa.rs
index 0c0e244..765e5f4 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -197,27 +197,25 @@ impl<S: StateID> NFA<S> {
self.copy_matches(start_id, dst);
}
- fn add_dense_state(&mut self, depth: usize) -> Result<S> {
+ fn add_dense_state(&mut self) -> Result<S> {
... | 1 | 4 | 13 |
6210098131a611c58815b390d47a60da7c681c4a | Andrew Gallant | 2022-12-01T00:39:48 | rust: move to the 2021 edition | diff --git a/Cargo.toml b/Cargo.toml
index 873871a..a18b987 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ license = "Unlicense OR MIT"
categories = ["text-processing"]
autotests = false
exclude = ["/aho-corasick-debug"]
-edition = "2018"
+edition = "2021"
[workspace]
members = ["aho-corasick-debug",... | 1 | 1 | 1 |
3b7afdf41e636cf02fc3bcd32360c268417ef34f | Andrew Gallant | 2022-11-27T19:51:29 | bench: fix benchmarks
Now that byte classes and premultiplication are no longer meaningfully
configurable, we fix the benchmarks. | diff --git a/bench/src/bench.rs b/bench/src/bench.rs
index e4b2bbb..13339c2 100644
--- a/bench/src/bench.rs
+++ b/bench/src/bench.rs
@@ -98,51 +98,10 @@ fn define_aho_corasick_dfa<B, F>(
let counter = find_count.clone();
let haystack = corpus.to_vec();
- let name = format!("dfa/byteclass-premultiply/{}",... | 1 | 1 | 42 |
ac1fe99a47a7b13741596d4fd98bb72cd950cf58 | Andrew Gallant | 2022-11-27T19:20:00 | impl: remove 'AllBytesIter'
I probably could have removed this a long time ago, but I think it just
slipped through the cracks. 0..=255 is much nicer. | diff --git a/src/nfa.rs b/src/nfa.rs
index a88f03e..0c0e244 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -439,7 +439,7 @@ impl<S: StateID> Transitions<S> {
}
}
Transitions::Dense(ref dense) => {
- for b in AllBytesIter::new() {
+ for b in 0..=255 {... | 1 | 5 | 36 |
0c35edc7c53dda5b1297b1be2db525cade3525ed | Andrew Gallant | 2022-11-27T19:16:36 | impl: remove 'unsafe' by using 'copy_within'
'slice::copy_within' was stabilized in Rust 1.37, which is now way under
our MSRV. | diff --git a/src/buffer.rs b/src/buffer.rs
index f6f0466..0f97b5d 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -1,11 +1,11 @@
-use core::{cmp, ptr};
+use core::cmp;
use alloc::{vec, vec::Vec};
use std::io;
/// The default buffer capacity that we use for the stream buffer.
-const DEFAULT_BUFFER_CAPACITY: u... | 2 | 9 | 21 |
3aa87d3a62508ecca6d36252cabbc5a6491972e8 | Andrew Gallant | 2022-11-25T19:29:05 | dfa: shrink down to a single variant
This gets rid of 'Premultiplied'. All that's left now is a DFA with
premultiplied state IDs and equivalence classes.
This let's us also get rid of the 'Repr' vs 'DFA' split, since the
former was only used to represent the common bits between the different
types of DFAs. But now th... | diff --git a/src/dfa.rs b/src/dfa.rs
index 5cab5e4..5dac928 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -8,235 +8,15 @@ use crate::{
classes::ByteClasses,
error::Result,
nfa::{PatternID, PatternLength, NFA},
- prefilter::{Prefilter, PrefilterObj, PrefilterState},
+ prefilter::{Prefilter, PrefilterO... | 1 | 80 | 282 |
15efdab0af1777a65e29ec1d8c7ced6764ea6c5a | Andrew Gallant | 2022-11-23T19:44:32 | api: remove 'premultiply' option
This was deprecated some time ago. We will always enable
premultiplication.
The next step will be to always enable byte classes, albeit, with the
option to still disable them so that transitions are easier to debug.
Note though, than even when disabled, the byte class map will still b... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index ca1d5fe..c5e4379 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1931,38 +1931,6 @@ impl AhoCorasickBuilder {
self.dfa_builder.byte_classes(yes);
self
}
-
- /// Premultiply state identifiers in the transition table. This o... | 3 | 12 | 262 |
54da4b04dfb1550f545788b9e1815725c35c5899 | Andrew Gallant | 2022-11-23T13:30:33 | cleanup: remove some dead code
It turns out that we weren't using the "leftmost with state" code at
all. I believe I had originally added this in an attempt to make the
leftmost searching work with streams, but I wasn't able to tie it
together and forgot to get rid of part of the aborted attempt. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index cdf26a3..ca1d5fe 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -283,7 +283,7 @@ impl<S: StateID> AhoCorasick<S> {
/// ```
pub fn find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
let mut prestate = PrefilterState::new(... | 3 | 20 | 150 |
cdf47a442db8a1fdee1f51349c53ef2ab4cf7810 | Andrew Gallant | 2022-11-22T18:38:14 | test: re-enable doc-comment
Now that we've bumped the MSRV to Rust 1.56, so it's time to re-enable
doc-comment. | diff --git a/Cargo.toml b/Cargo.toml
index a43e872..02788e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,9 +27,7 @@ std = ["memchr/std"]
memchr = { version = "2.4.0", default-features = false }
[dev-dependencies]
-# TODO: Re-enable this once the MSRV is 1.43 or greater.
-# See: https://github.com/BurntSushi/aho-... | 2 | 3 | 9 |
0fbc1ad576dd67898f78b533bda0b7b90c54a2fc | Adrian Taylor | 2023-01-05T03:35:18 | fuzz: initial implementation
PR #89 | diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
new file mode 100644
index 0000000..7725057
--- /dev/null
+++ b/fuzz/Cargo.toml
@@ -0,0 +1,25 @@
+[package]
+name = "aho-corasick-fuzz"
+version = "0.0.0"
+authors = ["Automatically generated"]
+publish = false
+edition = "2018"
+
+[package.metadata]
+cargo-fuzz = true
+
+... | 2 | 101 | 0 |
7705c0aab68d67ed71caf2c43c05b7dacf2db48f | Andrew Gallant | 2022-11-22T02:58:23 | nfa: fix 'heap_bytes' calculation
We weren't previously accounting for the memory used by 'State' itself,
and instead only counts the *heap* memory used by 'State'.
Fixes #85 | diff --git a/src/nfa.rs b/src/nfa.rs
index c4e26cc..05c5cfb 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -1013,7 +1013,7 @@ impl<'a, S: StateID> Compiler<'a, S> {
fn calculate_size(&mut self) {
let mut size = 0;
for state in &self.nfa.states {
- size += state.heap_bytes();
+ ... | 1 | 1 | 1 |
9e42ff1c95ed7409e1629630bebbcd0ccb7ff80f | Andrew Gallant | 2022-11-22T02:49:45 | doc: note that Unicode case folding is unlikely to happen
Closes #70 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 6d1c5c1..cfd74fd 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1795,9 +1795,12 @@ impl AhoCorasickBuilder {
/// Enabling this option does not change the search algorithm, but it may
/// increase the size of the automaton.
///
- ... | 1 | 6 | 3 |
4bd157881a270626f5de47c6b5d16fe86bbb2df8 | James Youngman | 2022-11-22T02:45:36 | doc: fix wording
PR #90 | diff --git a/src/packed/mod.rs b/src/packed/mod.rs
index 25a7966..97c40ff 100644
--- a/src/packed/mod.rs
+++ b/src/packed/mod.rs
@@ -4,7 +4,7 @@ number of patterns.
This sub-module provides vectorized routines for quickly finding matches of a
small number of patterns. In general, users of this crate shouldn't need ... | 1 | 1 | 1 |
c640920ee59d770d4c10fd20a72bf912be4fef1e | Bráulio Bezerra | 2022-11-22T02:44:52 | doc: remove duplicate "the"
PR #94 | diff --git a/src/nfa.rs b/src/nfa.rs
index 82489c3..c4e26cc 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -65,7 +65,7 @@ pub struct NFA<S> {
/// A set of equivalence classes in terms of bytes. We compute this while
/// building the NFA, but don't use it in the NFA's states. Instead, we
/// use this for bui... | 1 | 1 | 1 |
2a6d8f3d68af833204aed11dc34005bd50994e32 | Andrew Gallant | 2022-06-02T15:58:43 | nfa: massively simplify leftmost failure transitions
The key insight here is that all we need to do to support leftmost
semantics is to omit ALL failure transitions that appear after a match
state in the trie. (And to omit any entries in the trie that cross a
previously existing match state for leftmost-first semantic... | diff --git a/src/automaton.rs b/src/automaton.rs
index b971bf3..d88743a 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -68,11 +68,11 @@ use crate::Match;
///
/// Every automaton has exactly one fail state, one dead state and exactly one
/// start state. Generally, these correspond to the first, second and t... | 3 | 86 | 247 |
9d72e93c873f03344a4f0d1b3e86575702961bfd | Ten0 | 2022-09-03T17:28:54 | api: add Match::len method
PR #97 | diff --git a/src/lib.rs b/src/lib.rs
index 9a3d084..4465a56 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -275,6 +275,12 @@ impl Match {
self.end
}
+ /// The length, in bytes, of the match.
+ #[inline]
+ pub fn len(&self) -> usize {
+ self.len
+ }
+
/// Returns true if and only if ... | 1 | 6 | 0 |
c1526a8a543e179b82f275310c775c6a12c05ae3 | Andrew Gallant | 2022-06-02T15:58:26 | lint: remove dead code
The unused 'start' field in NonMatch is likely a remnant of some
experiments I was doing to get streaming search working with
leftmost match semantics.
The fact that 'config' is unused in the packed searcher was at
first surprising, but it's only ever used as part of construction. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index d6238b6..6d1c5c1 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1355,7 +1355,7 @@ struct StreamChunkIter<'a, R, S: StateID> {
#[derive(Debug)]
enum StreamChunk<'r> {
/// A chunk that does not contain any matches.
- NonMatch { bytes: &'r ... | 2 | 5 | 15 |
4499d7fdb41c6279ea1367bccf3daca9cb06c36c | Petar Dambovaliev | 2021-05-12T16:01:21 | impl: remove unused field and elide lifetime
Fixes #80 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 2b1aa5c..d6238b6 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1219,7 +1219,6 @@ pub struct FindOverlappingIter<'a, 'b, S: StateID> {
prestate: PrefilterState,
haystack: &'b [u8],
pos: usize,
- last_match_end: usize,
state_... | 1 | 1 | 3 |
8ac8f73a2db13edc0cd3cbc4cb0dc9129ff5e8c3 | Andrew Gallant | 2021-04-30T23:52:55 | build: fix compilation on i686
It looks like 'cargo fix' didn't quite fix all 'use' statements. | diff --git a/src/packed/teddy/mod.rs b/src/packed/teddy/mod.rs
index 7f2ba67..3268cdf 100644
--- a/src/packed/teddy/mod.rs
+++ b/src/packed/teddy/mod.rs
@@ -1,11 +1,11 @@
#[cfg(target_arch = "x86_64")]
pub use crate::packed::teddy::compile::Builder;
-#[cfg(target_arch = "x86_64")]
-pub use crate::packed::teddy::runti... | 1 | 6 | 6 |
2281bf6971da93eb8ebb014bf49349c6f481cd0b | Andrew Gallant | 2021-04-30T23:25:30 | deps: update to memchr 2.4
We also use the 'std' feature in lieu of the 'use_std' feature, which
was deprecated quite some time ago. | diff --git a/Cargo.toml b/Cargo.toml
index 094014e..6e9cb2b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,15 +23,15 @@ name = "aho_corasick"
[features]
default = ["std"]
-std = ["memchr/use_std"]
+std = ["memchr/std"]
[dependencies]
-memchr = { version = "2.2.0", default-features = false }
+memchr = { version ... | 1 | 3 | 3 |
04e8c741757a301041c9df7b813892400734faca | Andrew Gallant | 2021-04-30T22:51:46 | api: deprecate byte classes and premultiply options
These options aren't really carrying their weight. In a future release,
aho-corasick will make both options enabled by default all the time with
the impossibility of disabling them. The main reason for this is that
these options require a quadrupling in the amount of... | diff --git a/aho-corasick-debug/main.rs b/aho-corasick-debug/main.rs
index 751cc01..5f5a3b9 100644
--- a/aho-corasick-debug/main.rs
+++ b/aho-corasick-debug/main.rs
@@ -122,6 +122,8 @@ impl Args {
eprintln!("pattern read time: {:?}", read_time);
let start = Instant::now();
+ // TODO: remove w... | 3 | 23 | 13 |
c3136f12daf934631c48d2ccaa13a5964d48f26d | Andrew Gallant | 2021-04-30T22:44:27 | bench: update to criterion 0.3.4 | diff --git a/bench/Cargo.lock b/bench/Cargo.lock
deleted file mode 100644
index ccbe8d3..0000000
--- a/bench/Cargo.lock
+++ /dev/null
@@ -1,494 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-[[package]]
-name = "aho-corasick"
-version = "0.6.10"
-dependencies = [
-... | 2 | 12 | 509 |
45a4ee770e45805bd79d391031eacc846262a645 | Andrew Gallant | 2021-04-30T22:38:01 | edition: run 'cargo fix --edition --all' | diff --git a/Cargo.toml b/Cargo.toml
index 37a6852..094014e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,16 +13,10 @@ autotests = false
exclude = [
"/aho-corasick-debug", "/ci/*", "/.travis.yml", "/appveyor.yml",
]
+edition = "2018"
[workspace]
-members = ["bench"]
-# We'd ideally not do this, but since the ... | 22 | 68 | 73 |
682f96a7fef18c03edb680172c347ffb33116d71 | Andrew Gallant | 2020-11-03T17:05:41 | nfa: fix another ASCII case insensitive bug
When building the failure transitions, we iterate over the transitions
of each state. When ASCII case insensitivity is enabled, it's possible
for this transition list to contain duplicate states which in turn
results in creating duplicate matches in the NFA graph. It turns o... | diff --git a/src/nfa.rs b/src/nfa.rs
index 809d5ef..217be50 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -858,10 +858,17 @@ impl<'a, S: StateID> Compiler<'a, S> {
while let Some(id) = queue.pop_front() {
let mut it = self.nfa.iter_transitions_mut(id);
while let Some((b, next)) = it.nex... | 2 | 31 | 7 |
e5ea12873a56dd9dd54c462c9e11d61f96238d1f | Andrew Gallant | 2020-10-12T23:15:38 | prefilter: fix bug when doing a stream search
This fixes yet another bug in the prefilter. Sigh. This only occurs when
doing a stream search. The problem is that the stream handling code
assumes that if no match is found at the end of the buffer, then the
current state of the automaton is correctly updated and the buf... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 1805ec6..9069396 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -6,7 +6,7 @@ use dfa::{self, DFA};
use error::Result;
use nfa::{self, NFA};
use packed;
-use prefilter::PrefilterState;
+use prefilter::{Prefilter, PrefilterState};
use state_id::S... | 5 | 190 | 24 |
39b029bb222eb04b03c9dfd7538c0fdb544fc579 | Ten0 | 2020-07-01T17:16:53 | doc: fix confusing typo
PR #63 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 7880d13..1805ec6 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1847,7 +1847,7 @@ impl AhoCorasickBuilder {
/// finite automaton (NFA) is used instead.
///
/// The main benefit to a DFA is that it can execute searches more quickly
-... | 1 | 1 | 1 |
e2cb94a38499732b9399c7261395052b8dbc1ec0 | Andrew Gallant | 2020-06-23T12:26:27 | tests: remove use of doc_comment crate
It relies on `cfg(doctest)`, which wasn't stabilized until Rust 1.43.
Interestingly, it compiled on Rust 1.28, but didn't compile on, e.g.,
Rust 1.39. This breaks our MSRV policy, so we unfortunately remove the
use of doc_comment for now. It's likely possible to conditionally
ena... | diff --git a/Cargo.toml b/Cargo.toml
index 95b091a..e7782ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,6 +35,8 @@ std = ["memchr/use_std"]
memchr = { version = "2.2.0", default-features = false }
[dev-dependencies]
+# TODO: Re-enable this once the MSRV is 1.43 or greater.
+# See: https://github.com/BurntSushi/... | 2 | 7 | 5 |
6b1acde65b5916897a5d6ce4bd90f04bb242004e | Draphar | 2020-04-30T17:19:37 | api: respect the closure return value
This fixes a bug where the replace_all_with routine wouldn't actually
stop when the closure returned false, even though the documentation
promised it would.
This commit includes test cases in the form of documentation examples.
Closes #59 | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 9b7d9e7..7880d13 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -502,7 +502,7 @@ impl<S: StateID> AhoCorasick<S> {
/// The closure accepts three parameters: the match found, the text of
/// the match and a string buffer with which to writ... | 1 | 45 | 7 |
8b479a60906d20c38796fb7f2fd212616e64844b | Andrew Gallant | 2020-03-08T23:45:57 | style: fix rust-analyzer warnings
I still haven't figured out how to turn these warnings off. So just fix
them. | diff --git a/src/dfa.rs b/src/dfa.rs
index e6579c6..1bf37d5 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -637,8 +637,8 @@ impl Builder {
heap_bytes: 0,
prefilter: nfa.prefilter_obj().map(|p| p.clone()),
byte_classes: byte_classes.clone(),
- trans: trans,
- mat... | 5 | 18 | 17 |
e9110e994ba784ff9f813660f96d914dfe53207d | Andrew Gallant | 2020-03-08T23:45:31 | prefilter: fix another case insensitive prefilter bug
This fixes another bug in the handling of case insensitivity inside
the rare byte prefilter. In particular, we were not correctly populating
the byte offset table when ASCII case insensitivity was enabled. Instead
of just setting the offsets for bytes we've seen, w... | diff --git a/src/prefilter.rs b/src/prefilter.rs
index df31e14..bda215d 100644
--- a/src/prefilter.rs
+++ b/src/prefilter.rs
@@ -591,7 +591,7 @@ impl RareBytesBuilder {
// `memchr2` for `k` and `j`.
let mut found = false;
for (pos, &b) in bytes.iter().enumerate() {
- self.byte_offs... | 2 | 36 | 1 |
d2ade94657cef9e92fb0ac36431dbf66fe2cb61e | Andrew Gallant | 2020-02-27T01:10:17 | prefilter: fix rare byte prefilter
This fixes a rather nasty bug that occurred when the rare byte prefilter
computed its shift offset incorrectly. In particular, when a rare byte
is found using a prefilter, we shift backwards in the haystack by the
maximum amount possible before confirming whether a match exists or no... | diff --git a/src/prefilter.rs b/src/prefilter.rs
index 1dd073d..df31e14 100644
--- a/src/prefilter.rs
+++ b/src/prefilter.rs
@@ -371,8 +371,14 @@ struct RareBytesBuilder {
/// Whether this prefilter should account for ASCII case insensitivity or
/// not.
ascii_case_insensitive: bool,
- /// A set of by... | 2 | 101 | 55 |
fb6f50207009512a96a0cb1085ed9695ec3cfba3 | Andrew Gallant | 2020-01-22T00:28:06 | safety: add TODO about removing ptr::copy
Once our MSRV is high enough, we'll be able to use the safe
[T]::copy_within method instead of ptr::copy. | diff --git a/src/buffer.rs b/src/buffer.rs
index 01a8453..1008196 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -117,6 +117,8 @@ impl Buffer {
// SAFETY: A buffer contains Copy data, so there's no problem
// moving it around. Safety also depends on our indices being in
// boun... | 1 | 2 | 0 |
aebe8b15beb662d256590d0b96d1c0f50251995d | Andrew Gallant | 2020-01-21T23:56:32 | safety: add docs justifying removal of unsafe | diff --git a/src/automaton.rs b/src/automaton.rs
index 0fbf01a..2ada1a0 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -28,6 +28,42 @@ use Match;
// for tracking the state ID and one that doesn't. We should ideally do the
// same for standard searching, but my sanity stopped me.
+// SAFETY RATIONALE: P... | 1 | 36 | 0 |
4d9b4bbe2edd6928c064fd27134acb03f5208bd5 | Andrew Gallant | 2020-01-21T16:01:30 | safety: remove all unsafe from FSM code
This continues the trajectory of the previous commit and removes all
unsafe code from the core FSM matching loops. Namely, we stop using raw
pointers and use indices instead. This results an a second bounds check
in our core loop, but this also does not appear to regress perform... | diff --git a/src/automaton.rs b/src/automaton.rs
index 1298430..0fbf01a 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -175,66 +175,49 @@ pub trait Automaton {
prestate: &mut PrefilterState,
prefilter: Option<&dyn Prefilter>,
haystack: &[u8],
- at: usize,
+ mut at: usiz... | 1 | 117 | 161 |
4007169f0e90e684efb83c66f68166dbc1cdb50c | Andrew Gallant | 2020-01-18T17:36:21 | safety: remove most unsafe uses in FSM code
Despite my best efforts, and despite earlier conclusions to the
contrary, I have been unable to find a reliable benchmark that
demonstrates these `unsafe` uses improved performance. Interestingly,
removing the unchecked accesses actually seems to _improve_ performance.
For ... | diff --git a/src/automaton.rs b/src/automaton.rs
index 07615b7..1298430 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -39,8 +39,8 @@ use Match;
/// only when at least one match has been observed.
///
/// Every automaton also has one or more match states, such that
-/// `Automaton::is_match_state_unchecked(... | 5 | 32 | 51 |
3b35a99d82877aa1c08ea941d4dbaf7d540b989d | Andrew Gallant | 2020-01-18T14:35:41 | deps: update to criterion 0.3 | diff --git a/bench/Cargo.toml b/bench/Cargo.toml
index eebc306..20c8069 100644
--- a/bench/Cargo.toml
+++ b/bench/Cargo.toml
@@ -17,5 +17,5 @@ harness = false
path = "src/bench.rs"
[dependencies]
-criterion = "0.2"
+criterion = "0.3"
aho-corasick = { version = "*", path = ".." }
diff --git a/bench/src/bench.rs b/b... | 2 | 3 | 3 |
99ba2b4726cf63f7671df54a3821dcd61e43694f | Andrew Gallant | 2020-01-29T14:07:38 | ac: fix ascii case insensitivity for DFAs
It appears that ASCII case insensitive matching was totally broken for
DFAs. Namely, while the DFA machine construction logic itself was sound,
the equivalence classes built during NFA construction were incorrect.
Namely, if ASCII case insensitivity was enabled, then the case
... | diff --git a/src/nfa.rs b/src/nfa.rs
index 1e8fe39..de0c850 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -702,6 +702,10 @@ impl<'a, S: StateID> Compiler<'a, S> {
// building a DFA. They would technically be useful for the
// NFA, but it would require a second pass over the patterns.
... | 2 | 95 | 0 |
84aeead8b75255101d035830df830e6184e0c1f8 | Andrew Gallant | 2019-09-29T11:46:57 | style: new rustfmt changes | diff --git a/bench/src/sherlock.rs b/bench/src/sherlock.rs
index d02a3f1..2c5e6e4 100644
--- a/bench/src/sherlock.rs
+++ b/bench/src/sherlock.rs
@@ -27,12 +27,7 @@ pub fn all(c: &mut Criterion) {
0,
vec!["SherlockZ", "HolmesZ", "WatsonZ", "IreneZ", "MoriartyZ"],
);
- define_sherlock(
- ... | 1 | 1 | 6 |
4092c4b441200310a13c6edf59e19f30dc1e902b | Hiroki Kobayashi | 2019-08-15T15:10:32 | doc: fix typos
PR #46 | diff --git a/src/automaton.rs b/src/automaton.rs
index 2447639..07615b7 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -174,7 +174,7 @@ pub trait Automaton {
}
}
- // It's important for this to always be inlined. Namely, it's only caller
+ // It's important for this to always be inlined. ... | 2 | 4 | 4 |
fc74966a5a126c785587df2b3722a0679aff547e | Andrew Gallant | 2019-08-03T14:42:10 | api: add heap_bytes
This commit causes the prefilters to be included in the `heap_bytes`
calculation.
This commit also fixes a bug where the Teddy prefilter was used even if
ASCII case insensitivity was enabled. We should add support for this to
Teddy proper, but until then, avoid using it. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index da12603..9b7d9e7 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -943,8 +943,8 @@ impl<S: StateID> AhoCorasick<S> {
self.match_kind.supports_stream()
}
- /// Returns the total amount of heap used by this automaton, in units of
- ... | 9 | 95 | 3 |
9785615f34e68d71b2ebc88045dcc3c9b907912b | Markus Westerlind | 2019-04-08T12:06:04 | refactor: encapsulate the dense states in a type
This permits all accesses and mutations to dense transitions to elide
bounds checks without also spreading unsafe everywhere. We can do this
because dense transitions always have 256 elements, which means every
`u8` value is guaranteed to be a valid index.
Closes #41 | diff --git a/src/nfa.rs b/src/nfa.rs
index ca7bcbf..ee705f2 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -2,6 +2,7 @@ use std::cmp;
use std::collections::{BTreeSet, VecDeque};
use std::fmt;
use std::mem::size_of;
+use std::ops::{Index, IndexMut};
use ahocorasick::MatchKind;
use automaton::Automaton;
@@ -186,7 +18... | 1 | 51 | 12 |
579631b7bc8d73aa407ca756d294e69af99fb073 | Markus Westerlind | 2019-03-31T10:04:05 | refactor: remove redundant get_unchecked
For an array that always contains 256 elements, every `u8` value is a
valid index, so we can encapsulate the safety here.
Closes #41 | diff --git a/src/classes.rs b/src/classes.rs
index f1933c4..fe20668 100644
--- a/src/classes.rs
+++ b/src/classes.rs
@@ -34,14 +34,9 @@ impl ByteClasses {
/// Get the equivalence class for the given byte.
#[inline]
pub fn get(&self, byte: u8) -> u8 {
- self.0[byte as usize]
- }
-
- /// Get t... | 2 | 5 | 10 |
e5c435f416b6529d28b510279fa2e65f97df47ff | Andrew Gallant | 2019-08-01T23:30:18 | ac: fix memory explosion when using case insensitivity
This fixes an neat bug in how we built the automaton for handling ASCII
case insensitivity. Namely, when ASCII case insensitivity is enabled, we
simply draw two transitions for each ASCII letter byte seen to the next
state instead of one byte. This works well, but... | diff --git a/src/nfa.rs b/src/nfa.rs
index fad1fef..74d009b 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -1,5 +1,5 @@
use std::cmp;
-use std::collections::VecDeque;
+use std::collections::{BTreeSet, VecDeque};
use std::fmt;
use std::mem::size_of;
@@ -781,16 +781,23 @@ impl<'a, S: StateID> Compiler<'a, S> {
... | 2 | 73 | 5 |
063ca0d253b1cfcef9f6b5533bee0d1fd2737c33 | Andrew Gallant | 2019-07-05T17:40:18 | prefilter: add rare byte prefilter
This adds a long overdue prefilter to Aho-Corasick for rare byte
scanning. That is, in addition to the start-byte prefilter, we now have
a prefilter that tries to heuristically detect "rare" bytes in a given
set of patterns, and then use those to quickly scan to candidate
matches. It... | diff --git a/bench/src/sherlock.rs b/bench/src/sherlock.rs
index febbebb..d02a3f1 100644
--- a/bench/src/sherlock.rs
+++ b/bench/src/sherlock.rs
@@ -27,6 +27,12 @@ pub fn all(c: &mut Criterion) {
0,
vec!["SherlockZ", "HolmesZ", "WatsonZ", "IreneZ", "MoriartyZ"],
);
+ define_sherlock(
+ ... | 5 | 757 | 28 |
32a234432e8f4d2d059d0c8d469cfdcb26bdc236 | Andrew Gallant | 2019-07-04T21:22:37 | prefilter: light refactoring
This lightly refactors how prefilters are built. Instead of analyzing the
NFA at the end, we build prefilters by feeding them the patterns directly.
This is a much simpler way of doing things, and lays the ground work for
more sophisticated prefilter mechanisms. | diff --git a/bench/src/sherlock.rs b/bench/src/sherlock.rs
index 1767eaa..febbebb 100644
--- a/bench/src/sherlock.rs
+++ b/bench/src/sherlock.rs
@@ -21,6 +21,12 @@ pub fn all(c: &mut Criterion) {
);
define_sherlock(c, "name/alt4", 582, vec!["Sher", "Hol"]);
define_sherlock(c, "name/alt5", 639, vec!["Sher... | 4 | 160 | 45 |
489c908cd5a383cb8f75cc8ed9f35cfd04c2a979 | Andrew Gallant | 2019-07-09T21:51:18 | toml: clean-up Cargo.toml errors | diff --git a/Cargo.toml b/Cargo.toml
index 23c3165..632cc87 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,11 +10,13 @@ keywords = ["string", "search", "text", "aho", "multi"]
license = "Unlicense/MIT"
categories = ["text-processing"]
autotests = false
-exclude = ["/aho-corasick-debug", "/bench", "/ci/*", "/.travis... | 1 | 4 | 2 |
cdcc7ab6c513738481952716539eca5bab886229 | Andrew Gallant | 2019-07-02T14:00:09 | compiler: fix leftmost match bug
This commit fixes a subtle bug for leftmost-{first,longest} match
semantics. In particular, if one searched for the patterns `ab` and `a`
in the haystack `aa`, then the only match that would be reported would
be at position `1`. The correct result is a match at both position `0`
and `1... | diff --git a/src/nfa.rs b/src/nfa.rs
index 289ebaa..a6d0f34 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -924,9 +924,21 @@ impl<'a, S: StateID> Compiler<'a, S> {
let mut queue: VecDeque<QueuedState<S>> = VecDeque::new();
let start = QueuedState::start(&self.nfa);
for b in AllBytesIter::new() {... | 2 | 30 | 5 |
56d09ff9027d4b924714f67afc44c8a22971fb0b | Andrew Gallant | 2019-07-02T00:36:16 | compat: allow bare trait objects
We aren't ready to bump the MSRV. | diff --git a/src/lib.rs b/src/lib.rs
index 41b15b8..60daef3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -180,6 +180,7 @@ performance in some cases. For that reason, prefilters can be disabled via
*/
#![deny(missing_docs)]
+#![allow(bare_trait_objects)]
// We can never be truly no_std, but we could be alloc-only ... | 1 | 1 | 0 |
f166d2e63d0d7a41339b5e7f8c939dd4196f92f0 | Guillaume Gomez | 2019-05-01T15:09:01 | test: check examples in README
PR #43 | diff --git a/Cargo.toml b/Cargo.toml
index 9ddbf04..cd28ec2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,6 +29,9 @@ std = ["memchr/use_std"]
[dependencies]
memchr = { version = "2.2.0", default-features = false }
+[dev-dependencies]
+doc-comment = "0.3.1"
+
[profile.release]
debug = true
diff --git a/src/lib... | 2 | 9 | 0 |
5f220e63363ff5e5261457805e4a935d155cf76c | Andrew Gallant | 2019-03-31T11:40:51 | api: test for RefUnwindSafe
Requiring UnwindSafe is seemingly not sufficient. We also need to
require RefUnwindSafe. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index c8cc42f..fccd2b8 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2016,11 +2016,11 @@ mod tests {
#[test]
fn oibits() {
- use std::panic::UnwindSafe;
+ use std::panic::{RefUnwindSafe, UnwindSafe};
fn assert_send<... | 2 | 4 | 4 |
df7fee774310bc4b68f6cd307d82b6e925337ba7 | Andrew Gallant | 2019-03-31T11:35:50 | api: test for UnwindSafe
It appears that using a trait object internally implies that the containing
type cannot be assumed to be UnwindSafe. This wasn't previously an
explicit API guarantee, but the AhoCorasick automaton in 0.6.x was
UnwindSafe and it's probably a good idea to keep that particular feature.
Here, we s... | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 28283e4..c8cc42f 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2016,12 +2016,17 @@ mod tests {
#[test]
fn oibits() {
+ use std::panic::UnwindSafe;
+
fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}
+ ... | 2 | 7 | 1 |
9a1ece40d9af04eb0a9bf0de48380a8a2f34deec | Andrew Gallant | 2019-03-31T11:32:44 | test: remove debugging test | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 6376770..28283e4 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -2024,28 +2024,4 @@ mod tests {
assert_send::<AhoCorasickBuilder>();
assert_sync::<AhoCorasickBuilder>();
}
-
- #[test]
- fn watwat() {
- let haysta... | 1 | 0 | 24 |
d4407bdbdd0dba7ae9965fa07d6ea105a57a5b1a | Andrew Gallant | 2019-03-28T23:13:29 | prefilter: allow the prefilter to become inert
Using the prefilter has some overhead, so if the prefilter isn't
skipping a chunk of bytes on each call, then we should stop using it. We
achieve this by threading a PrefilterState through the search code which
manages the heuristic. | diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 591fd64..6376770 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -5,6 +5,7 @@ use buffer::Buffer;
use dfa::{self, DFA};
use error::Result;
use nfa::{self, NFA};
+use prefilter::PrefilterState;
use state_id::StateID;
use Match;
@@ -209,8 +210,... | 4 | 162 | 42 |
9e86c462e5ee643bb681d13c091361b7b5286091 | Andrew Gallant | 2019-03-28T02:17:36 | crates.io: reduce keywords | diff --git a/Cargo.toml b/Cargo.toml
index 27a0354..6598cf5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ description = "Fast multiple substring searching."
homepage = "https://github.com/BurntSushi/aho-corasick"
repository = "https://github.com/BurntSushi/aho-corasick"
readme = "README.md"
-keywords = ["... | 1 | 1 | 1 |
bfd36141067459bbda5e8e65ace4246a0c11b251 | Ruud van Asseldonk | 2018-10-18T08:19:05 | test: increase quickcheck iterations and data size
Generating SmallAscii of 2 characters was not sufficient, one bug with
the full dense automation is only reproducible for size 3 so far. So
make SmallAscii generate a bit longer strings.
With that change alone, the dense_full test fails only occasionally, so
increase... | diff --git a/src/lib.rs b/src/lib.rs
index 98cc4f0..8cccf71 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -748,7 +748,7 @@ mod tests {
use std::collections::HashSet;
use std::io;
- use quickcheck::{Arbitrary, Gen, quickcheck};
+ use quickcheck::{Arbitrary, Gen, QuickCheck};
use rand::Rng;
us... | 1 | 7 | 6 |
21457f988b6f4feda20ecb6bbe9e2a574c86f396 | Ruud van Asseldonk | 2018-10-18T08:10:16 | test: expand quickcheck tests to cover sparse automata | diff --git a/src/lib.rs b/src/lib.rs
index fd900ba..98cc4f0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -751,7 +751,7 @@ mod tests {
use quickcheck::{Arbitrary, Gen, quickcheck};
use rand::Rng;
- use super::{AcAutomaton, Automaton, Match, AllBytesIter, Dense};
+ use super::{AcAutomaton, Automaton, Mat... | 1 | 49 | 2 |
6798b2e1a91316d320fd0cc2a2f9813f38b35e85 | Ruud van Asseldonk | 2018-10-18T08:01:41 | test: make quickcheck property reusable | diff --git a/src/lib.rs b/src/lib.rs
index 1db0df3..fd900ba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1062,21 +1062,28 @@ mod tests {
matches
}
+ fn prop_ac_equals_naive<F>(
+ needles: Vec<SmallAscii>,
+ haystack: BiasAscii,
+ ac_find: F
+ ) -> bool where F: Fn(&[SmallAscii... | 1 | 18 | 11 |
8a002bff46a310df1b9bcf29ef3511399662b1a9 | Andrew Gallant | 2019-02-16T16:43:55 | full: add regression test for #35
This bug had the same root cause as #37. | diff --git a/src/lib.rs b/src/lib.rs
index cd71073..1db0df3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -751,7 +751,7 @@ mod tests {
use quickcheck::{Arbitrary, Gen, quickcheck};
use rand::Rng;
- use super::{AcAutomaton, Automaton, Match, AllBytesIter};
+ use super::{AcAutomaton, Automaton, Match, All... | 1 | 15 | 1 |
10e396710ac7476aa870a737905dfb4e3ca41e65 | Andrew Gallant | 2019-02-16T16:31:41 | full: fix dense representation bug
This commit fixes a bug in the "full" construction of Aho-Corasick into a
DFA. In particular, the `for_each_transition` routine was assuming that
the transitions in the "dense" (actually sparse) representation were
sorted in lexicographic order. But nothing maintained this invariant ... | diff --git a/src/lib.rs b/src/lib.rs
index 6ceb206..cd71073 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -559,7 +559,12 @@ impl Transitions for Dense {
fn set_goto(&mut self, b: u8, si: StateIdx) {
match self.0 {
DenseChoice::Sparse(ref mut m) => m.set_goto(b, si),
- DenseChoice::De... | 1 | 35 | 1 |
b9a52369ee556bae4467b57ae1e95b47190969a8 | Igor Gnatenko | 2018-10-27T21:01:15 | exclude useless files from crates.io | diff --git a/Cargo.toml b/Cargo.toml
index 8df056f..9b5fb57 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ repository = "https://github.com/BurntSushi/aho-corasick"
readme = "README.md"
keywords = ["string", "search", "text", "aho", "corasick"]
license = "Unlicense/MIT"
-exclude = ["benches/sherlock.txt"]
... | 1 | 1 | 1 |
ecbd0640aa42521ca593dc6de8f908ce33487e34 | Markus Westerlind | 2018-08-13T11:02:57 | refactor: Add for_each_ok_transition to rely less on LLVM optimizing
Since the previous commit were so significant I find it safest to add
and explicit function for this so we don't rely on LLVM doing the
optimization for dense states.
Closes #33 | diff --git a/src/lib.rs b/src/lib.rs
index 0860afe..6ceb206 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -404,11 +404,9 @@ impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T> {
let mut transitions = Vec::new();
while let Some(si) = q.pop_back() {
- self.states[si as usize].for_each_tran... | 1 | 32 | 5 |
bf693c076a41a56f9d053d2354522c7355b712ae | Markus Westerlind | 2018-08-04T21:21:44 | perf: Use for_each_transition in AcAutomaton::fill (-84%)
```
name old ns/iter new ns/iter diff ns/iter diff % speedup
bench_construction 167,415 25,804 -141,611 -84.59% x 6.49
bench_full_construction 275,170 133,253 -141,917 -51.57% x 2.07
``` | diff --git a/src/lib.rs b/src/lib.rs
index 74b21f3..0860afe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -395,37 +395,47 @@ impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T> {
// Fill up the queue with all non-root transitions out of the root
// node. Then proceed by breadth first traversal.
... | 1 | 32 | 22 |
1eb28dc947d9bdc537a16c8f3a9382db31b80310 | Markus Westerlind | 2018-07-12T19:35:42 | perf: Skip the first goto call in full construction (-35%)
This is probably less significant when larger number of needles are used
but should still be a decent speed improvement.
```
name old ns/iter new ns/iter diff ns/iter diff % speedup
bench_construction 131,148 122,956 ... | diff --git a/src/full.rs b/src/full.rs
index 5e5f9c0..377940a 100644
--- a/src/full.rs
+++ b/src/full.rs
@@ -3,7 +3,6 @@ use std::mem;
use super::{
FAIL_STATE,
- AllBytesIter,
StateIdx, AcAutomaton, Transitions, Match,
usize_bytes, vec_bytes,
};
@@ -120,13 +119,23 @@ impl<P: AsRef<[u8]>> Automaton... | 2 | 58 | 12 |
b9364c5efb473fb997a79fd7c84bf9c97b3571a7 | Markus Westerlind | 2018-07-12T15:16:42 | perf: Use the FullAcAutomaton being built for memoization (-12%) | diff --git a/src/full.rs b/src/full.rs
index 4b2fd6f..5e5f9c0 100644
--- a/src/full.rs
+++ b/src/full.rs
@@ -120,8 +120,9 @@ impl<P: AsRef<[u8]>> Automaton<P> for FullAcAutomaton<P> {
impl<P: AsRef<[u8]>> FullAcAutomaton<P> {
fn build_matrix<T: Transitions>(&mut self, ac: &AcAutomaton<P, T>) {
for (si, s... | 2 | 27 | 2 |
9253d5a4730636e323792cf3c034641f306802b8 | Markus Westerlind | 2018-07-12T14:46:10 | perf: Avoid a boundscheck in next_state (-8%) | diff --git a/src/lib.rs b/src/lib.rs
index d2a7622..db12d3c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -253,12 +253,13 @@ impl<P: AsRef<[u8]>, T: Transitions> Automaton<P> for AcAutomaton<P, T> {
#[inline]
fn next_state(&self, mut si: StateIdx, b: u8) -> StateIdx {
loop {
- let maybe_si =... | 1 | 3 | 2 |
9cfe997016cfb65354656a219a1621d1a82ff160 | Markus Westerlind | 2018-07-12T12:25:16 | perf: Use extend_from_slice instead of push (-2%) | diff --git a/src/full.rs b/src/full.rs
index c44c449..4b2fd6f 100644
--- a/src/full.rs
+++ b/src/full.rs
@@ -123,9 +123,7 @@ impl<P: AsRef<[u8]>> FullAcAutomaton<P> {
for b in AllBytesIter::new() {
self.set(si as StateIdx, b, ac.next_state(si as StateIdx, b));
}
- f... | 1 | 1 | 3 |
d5413254a251d41348bb36ff0294148425d09ad3 | Markus Westerlind | 2018-07-12T13:11:47 | fix: Don't return a 0 at the end of AllBytesIter | diff --git a/src/lib.rs b/src/lib.rs
index d66ee04..d2a7622 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -304,7 +304,7 @@ impl Iterator for AllBytesIter {
type Item = u8;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
- if self.0 <= 256 {
+ if self.0 < 256 {
let b = self.0... | 1 | 11 | 2 |
59124b28a684670b280f6095d9bc294ddeb41a55 | Markus Westerlind | 2018-06-27T18:52:36 | perf: speedup the automaton construction in debug builds
This commit makes some changes to the implementation that should
speed up the construction of Aho-Corasick automatons in debug builds.
PR #31 | diff --git a/benches/bench.rs b/benches/bench.rs
index d51bcae..0e68e2a 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -57,6 +57,40 @@ fn bench_naive_no_match<S>(b: &mut Bencher, needles: Vec<S>, haystack: &str)
b.iter(|| assert!(!naive_find(&needles, haystack)));
}
+#[bench]
+fn bench_construction(b: ... | 3 | 104 | 21 |
864e82384260458e62a99d91cedf0128f224d702 | Ossi Herrala | 2018-05-14T20:44:02 | style: fix some Clippy nags | diff --git a/src/autiter.rs b/src/autiter.rs
index 21a02a4..dfad28f 100644
--- a/src/autiter.rs
+++ b/src/autiter.rs
@@ -42,7 +42,7 @@ pub trait Automaton<P> {
/// Returns true if the automaton has no patterns.
#[inline]
fn is_empty(&self) -> bool {
- self.len() == 0
+ self.patterns().is_em... | 3 | 11 | 13 |
c061333963a3abd7fe715b364eff0ca92ad8f98e | Bruce Mitchener | 2018-05-13T22:58:48 | deps: update csv & docopt to 1.0 | diff --git a/Cargo.toml b/Cargo.toml
index 40bfef7..c1d8934 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,8 +27,8 @@ bench = false
memchr = "2"
[dev-dependencies]
-csv = "1.0.0-beta.5"
-docopt = "0.8"
+csv = "1"
+docopt = "1"
memmap = "0.6"
quickcheck = { version = "0.6", default-features = false }
serde = "1" | 1 | 2 | 2 |
16fd30f28866cd9560a7fb2f5b5264c1e93d867f | Andrew Gallant | 2018-03-11T16:33:59 | deps: remove rand dependency
Fixes #27 | diff --git a/Cargo.toml b/Cargo.toml
index 286442b..40bfef7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,6 @@ csv = "1.0.0-beta.5"
docopt = "0.8"
memmap = "0.6"
quickcheck = { version = "0.6", default-features = false }
-rand = "0.4"
serde = "1"
serde_derive = "1"
diff --git a/src/lib.rs b/src/lib.rs
in... | 2 | 2 | 3 |
c3a2ebb7fa47169e194115dcf65133167bef399b | Andrew Gallant | 2018-01-01T15:11:44 | deps: update docopt and csv | diff --git a/Cargo.toml b/Cargo.toml
index ce353e2..286442b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,7 @@ name = "aho_corasick"
[[bin]]
name = "aho-corasick-dot"
+path = "src/main.rs"
test = false
doc = false
bench = false
@@ -26,12 +27,13 @@ bench = false
memchr = "2"
[dev-dependencies]
-csv = ... | 2 | 12 | 12 |
3013d3430c80ea0b555cab75f1eabee1e5de473c | Dan Burkert | 2017-10-28T22:28:48 | deps: update to memmap 0.6
`memmap` 0.6.0 introduces major API changes in anticipation of a 1.0
release. See https://github.com/danburkert/memmap-rs/releases/tag/0.6.0
for more information. CC danburkert/memmap-rs#33. | diff --git a/Cargo.toml b/Cargo.toml
index 658c1a3..ce353e2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,7 +28,7 @@ memchr = "2"
[dev-dependencies]
csv = "0.15"
docopt = "0.7"
-memmap = "0.5"
+memmap = "0.6"
quickcheck = { version = "0.6", default-features = false }
rand = "0.4"
rustc-serialize = "0.3"
diff --... | 2 | 11 | 22 |
30cee7ba8bc75c04a12cd3cb8aec6e11e98ef845 | Igor Gnatenko | 2018-01-01T11:16:36 | deps: bump quickcheck to 0.6, rand to 0.4 | diff --git a/Cargo.toml b/Cargo.toml
index b314846..658c1a3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,8 +29,8 @@ memchr = "2"
csv = "0.15"
docopt = "0.7"
memmap = "0.5"
-quickcheck = { version = "0.5", default-features = false }
-rand = "0.3"
+quickcheck = { version = "0.6", default-features = false }
+rand = ... | 1 | 2 | 2 |
16b56abe22cc776dced763f2bf53f9c56cfce048 | Andrew Gallant | 2017-11-30T14:18:26 | Revert "Introduce `use_std` default feature"
This reverts commit 0440919f725e058d9f08e477fb634edbb93c6689.
We revert this because we shouldn't need features to make memchr compile
on wasm. Instead, we should change memchr to compile on wasm by default,
which was done here: https://github.com/BurntSushi/rust-memchr/pu... | diff --git a/Cargo.toml b/Cargo.toml
index 42832ad..a3e1534 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,12 +22,8 @@ test = false
doc = false
bench = false
-[features]
-default = ["use_std"]
-use_std = ["memchr/use_std"]
-
[dependencies]
-memchr = { version = "2", default-features = false }
+memchr = "2"
[de... | 1 | 1 | 5 |
0440919f725e058d9f08e477fb634edbb93c6689 | Volker Mische | 2017-11-29T22:20:56 | Introduce `use_std` default feature
aho-corasick depends on memchr which can optionally be compiled without
std. With the introduction of the `use_std` feature it is now possible
to compile aho-corasick with `default-features = false` which then uses
a memchr that doesn't depend on std.
This makes aho-corasick availa... | diff --git a/Cargo.toml b/Cargo.toml
index a3e1534..42832ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,8 +22,12 @@ test = false
doc = false
bench = false
+[features]
+default = ["use_std"]
+use_std = ["memchr/use_std"]
+
[dependencies]
-memchr = "2"
+memchr = { version = "2", default-features = false }
[de... | 1 | 5 | 1 |
a9a1729291838440286cb13bc0aa6035df35326d | Igor Gnatenko | 2017-11-29T10:12:32 | bump quickcheck to 0.5 | diff --git a/Cargo.toml b/Cargo.toml
index 31355f3..a3e1534 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,7 +29,7 @@ memchr = "2"
csv = "0.15"
docopt = "0.7"
memmap = "0.5"
-quickcheck = { version = "0.4", default-features = false }
+quickcheck = { version = "0.5", default-features = false }
rand = "0.3"
rustc-s... | 1 | 1 | 1 |
c880e210269d5f35bb64cf0e78071e6ea990d14e | Igor Gnatenko | 2017-11-08T16:22:20 | bump memchr to 2 | diff --git a/Cargo.toml b/Cargo.toml
index c7f128a..31355f3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ doc = false
bench = false
[dependencies]
-memchr = "1"
+memchr = "2"
[dev-dependencies]
csv = "0.15" | 1 | 1 | 1 |
334c11c21eef17ed2e08c5ad9d9c59b8b9bd4bff | Linus Färnstrand | 2017-08-29T18:55:24 | Remove documentation url from Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 8bc7f0a..c7f128a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,6 @@ name = "aho-corasick"
version = "0.6.3" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Fast multiple substring searching with finite state machines."
-documentation = "http... | 1 | 0 | 1 |
21c035ba9fb46bb85ae1e3789861f15ce097601a | Martin Geisler | 2017-07-24T22:08:48 | Add CI badge | diff --git a/Cargo.toml b/Cargo.toml
index f33ed53..8bc7f0a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,9 @@ keywords = ["string", "search", "text", "aho", "corasick"]
license = "Unlicense/MIT"
exclude = ["benches/sherlock.txt"]
+[badges]
+travis-ci = { repository = "BurntSushi/aho-corasick" }
+
[lib]
n... | 1 | 3 | 0 |
dbced3b70971c7ee7a881c7d4e8e6ead43b94f43 | Andrew Gallant | 2017-03-17T00:43:13 | Unroll part of the skip loop. | diff --git a/src/autiter.rs b/src/autiter.rs
index fe67746..21a02a4 100644
--- a/src/autiter.rs
+++ b/src/autiter.rs
@@ -239,6 +239,33 @@ fn skip_to_match<P, A: Automaton<P> + ?Sized, F: Fn(&A, &[u8], usize) -> usize>(
texti = skip(aut, text, texti + 1);
} else {
texti += 1;
+ ... | 1 | 27 | 0 |
76c5bc210e6e2a409204ea4b96a534e08f12f1d8 | Manish Goregaokar | 2017-02-04T00:55:33 | Don't publish The Adventures of Sherlock Holmes; there already are plenty of copies out there | diff --git a/Cargo.toml b/Cargo.toml
index 1f6f2f6..540b936 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ repository = "https://github.com/BurntSushi/aho-corasick"
readme = "README.md"
keywords = ["string", "search", "text", "aho", "corasick"]
license = "Unlicense/MIT"
+exclude = ["benches/sherlock.txt"]
... | 1 | 1 | 0 |
de896639ffa6e3e86e72a4c0b0fcd221115940de | Andrew Gallant | 2017-01-03T01:11:38 | bump dep versions | diff --git a/Cargo.toml b/Cargo.toml
index 6a32cf0..ec5d2fa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,8 +24,8 @@ memchr = "1"
[dev-dependencies]
csv = "0.15"
-docopt = "0.6"
-memmap = "0.2"
+docopt = "0.7"
+memmap = "0.5"
quickcheck = { version = "0.4", default-features = false }
rand = "0.3"
rustc-seriali... | 1 | 2 | 2 |
40d438b794308fade07e52cc0bcc17726e42e958 | Andrew Gallant | 2016-09-11T18:33:00 | Don't run memchr on non-ASCII bytes.
If any of our start bytes are non-ASCII, then don't try to do any fast
prefix skipping. The issue is that if you have non-ASCII needles/haystacks,
they're probably all in the same language and most codepoints are probably
encoded with the same start byte. Using memchr in those scen... | diff --git a/src/lib.rs b/src/lib.rs
index da03997..95ab071 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -328,6 +328,13 @@ impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T> {
self.start_bytes.push(c);
}
}
+ // If any of the start bytes are non-ASCII, then remove them al... | 1 | 7 | 1 |
d4a2ee86ee3dc004f1c6a5517fb060e9fed448f5 | Corey Farwell | 2016-02-16T02:32:45 | Bump memchr required version to compatible version
aho-corasic requires `memchr::memchr2` and `memchr::memchr3`. These were not added until memchr reached version 0.1.9.
https://github.com/BurntSushi/rust-memchr/commit/a098d3d3a831b93f593fad9f81ad2956c128b0b0
https://github.com/BurntSushi/rust-memchr/commit/19d0... | diff --git a/Cargo.toml b/Cargo.toml
index 78ae9bf..091a00d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ doc = false
bench = false
[dependencies]
-memchr = "0.1"
+memchr = "0.1.9"
[dev-dependencies]
csv = "0.14" | 1 | 1 | 1 |
49c4d3cca2b41e82335e5ec0288355dbfbaefcee | Andrew Gallant | 2016-02-14T22:07:41 | Make use of memchr2 and memchr3.
To prevent regressions because of additional branching, we manually
inline each use of memchr, memchr2 and memchr3. To do this in a sane
way, I moved `start_bytes` to the trait and removed `skip_to` and
`is_skippable`. This is nicer because this crate will now handle
skipping instead o... | diff --git a/Cargo.toml b/Cargo.toml
index 2086a79..56c1555 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ doc = false
bench = false
[dependencies]
-memchr = "0.1.*"
+memchr = "0.1"
[dev-dependencies]
csv = "0.14"
diff --git a/src/autiter.rs b/src/autiter.rs
index f447afd..0911f1a 100644
--- a/src/a... | 4 | 105 | 59 |
be9eeab0db84176afd482f03520ff47bb4e1fe3e | Andrew Gallant | 2016-01-31T15:17:40 | Update cli tool to show memory usage and optionally use "full" automaton. | diff --git a/examples/dict-search.rs b/examples/dict-search.rs
index b28f358..83ce2fb 100644
--- a/examples/dict-search.rs
+++ b/examples/dict-search.rs
@@ -24,6 +24,9 @@ Options:
-m <len>, --min-len <len> The minimum length for a keyword in UTF-8
encoded bytes. [default: 5]
-... | 1 | 35 | 6 |
83dd1d585f8b011dba33561100f791cb9a74a0b4 | Andrew Gallant | 2016-01-31T15:17:21 | Tweak threshold for switching to a dense representation.
Also, add methods of questionable value for estimating memory usage. | diff --git a/src/full.rs b/src/full.rs
index 22f5e66..60dcd28 100644
--- a/src/full.rs
+++ b/src/full.rs
@@ -1,11 +1,12 @@
use std::fmt;
+use std::mem;
use memchr::memchr;
use super::{
FAIL_STATE, ROOT_STATE,
- StateIdx, PatIdx,
- AcAutomaton, Transitions, Match,
+ StateIdx, AcAutomaton, Transition... | 2 | 95 | 21 |
152485774d5de06bc3a26d16f7324f404cbda5c9 | Andrew Gallant | 2016-01-31T15:13:39 | formatting | diff --git a/src/autiter.rs b/src/autiter.rs
index 984eb84..f447afd 100644
--- a/src/autiter.rs
+++ b/src/autiter.rs
@@ -1,7 +1,7 @@
-use std::io::{self, BufRead, Read};
+use std::io::{self, BufRead};
use std::marker::PhantomData;
-use super::{ROOT_STATE, PatIdx, StateIdx};
+use super::{ROOT_STATE, StateIdx};
///... | 1 | 47 | 26 |
304b8b277dc51562b80ea53fd67dc11e6d1ca188 | Joe Neeman | 2015-10-21T20:23:57 | Make Automaton object-safe. | diff --git a/benches/bench.rs b/benches/bench.rs
index c5f63e7..7b93c89 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -19,6 +19,16 @@ fn bench_aut_no_match<P: AsRef<[u8]>, T: Transitions>(
b.iter(|| assert!(aut.find(haystack).next().is_none()));
}
+fn bench_box_aut_no_match<P: AsRef<[u8]>, T: Transiti... | 2 | 43 | 16 |
d288ad8e4905425c37588c2053733c5cb001ce69 | Joe Neeman | 2015-10-19T21:04:57 | Allow searching in byte slices (and more). | diff --git a/src/autiter.rs b/src/autiter.rs
index fee21fe..44e289d 100644
--- a/src/autiter.rs
+++ b/src/autiter.rs
@@ -53,13 +53,13 @@ pub trait Automaton<P>: Sized {
}
/// Returns an iterator of non-overlapping matches in `s`.
- fn find<'a, 's>(
+ fn find<'a, 's, Q: ?Sized + AsRef<[u8]>>(
... | 1 | 6 | 6 |
fe50ba6919a5991e1e4fb074d3f976b016a2d46a | Joe Neeman | 2015-10-04T11:46:22 | Optimize MatchesOverlapping. | diff --git a/benches/bench.rs b/benches/bench.rs
index 20b2268..c5f63e7 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -29,6 +29,16 @@ fn bench_full_aut_no_match<P: AsRef<[u8]>, T: Transitions>(
b.iter(|| assert!(aut.find(haystack).next().is_none()));
}
+fn bench_full_aut_overlapping_no_match<P: AsRef<... | 2 | 72 | 32 |
85a0c97a9bedd662a1f959e17b76cca43361eed7 | Andrew Gallant | 2015-08-30T15:02:02 | allow deprecated. sigh. | diff --git a/src/lib.rs b/src/lib.rs
index f497f73..8242932 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -118,6 +118,7 @@ assert_eq!(matches, vec![Match { pati: 1, start: 0, end: 1}]);
```
*/
+#![allow(deprecated)] // for connect -> join
#![deny(missing_docs)]
extern crate memchr; | 1 | 1 | 0 |
b4de46cc60eb8d4b3f042f534ceeb2743c5db2ba | Andrew Gallant | 2015-08-30T15:00:59 | Stop use * deps. | diff --git a/Cargo.toml b/Cargo.toml
index 50efb37..7c4d8e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,11 +23,11 @@ bench = false
memchr = "0.1.*"
[dev-dependencies]
-csv = "*"
-docopt = "*"
-quickcheck = "*"
-rand = "*"
-rustc-serialize = "*"
+csv = "0.14"
+docopt = "0.6"
+quickcheck = "0.2"
+rand = "0.3"
+ru... | 1 | 5 | 5 |
807130ae4530102d2eb5671421739e255201fb21 | Andrew Dunham | 2015-07-10T17:58:18 | Add documentation about type parameters | diff --git a/src/autiter.rs b/src/autiter.rs
index 20f622b..4d18cba 100644
--- a/src/autiter.rs
+++ b/src/autiter.rs
@@ -4,6 +4,8 @@ use std::marker::PhantomData;
use super::{ROOT_STATE, PatIdx, StateIdx};
/// An abstraction over automatons and their corresponding iterators.
+/// The type parameter `P` is the type ... | 2 | 13 | 9 |
9467d49a0e9cbfae5a2674374440ac3929631074 | Andrew Dunham | 2015-07-09T23:41:48 | Fix benchmarks | diff --git a/benches/bench.rs b/benches/bench.rs
index ab4ddd0..20b2268 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -10,18 +10,18 @@ use test::Bencher;
const HAYSTACK_RANDOM: &'static str = include_str!("random.txt");
-fn bench_aut_no_match<T: Transitions>(
+fn bench_aut_no_match<P: AsRef<[u8]>, T: Tra... | 1 | 5 | 5 |
8509d1f12632b0c4cce961284019b03670890b36 | Andrew Dunham | 2015-07-09T23:37:11 | Doc tweaks, add a test for `pattern` type | diff --git a/src/lib.rs b/src/lib.rs
index 2dde83e..e2f9275 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -199,8 +199,8 @@ struct State<T> {
impl<P: AsRef<[u8]>> AcAutomaton<P> {
/// Create a new automaton from an iterator of patterns.
///
- /// The patterns must be convertible to Unicode `String` values vi... | 1 | 18 | 4 |
dbbcfd5ddad9ce92591a7cad30f03abef56522d3 | Andrew Dunham | 2015-07-09T23:32:28 | Finish getting AsRef to work properly | diff --git a/examples/dict-search.rs b/examples/dict-search.rs
index f234a8e..b28f358 100644
--- a/examples/dict-search.rs
+++ b/examples/dict-search.rs
@@ -74,7 +74,7 @@ fn write_matches<A, I>(aut: &A, it: I) -> Result<(), Box<Error>>
fn build_automaton(
dict_path: &str,
min_len: usize,
-) -> Result<AcAutom... | 3 | 25 | 21 |
9412dbfe317485c2299b5dbc6fd4180e24b4c012 | Andrew Dunham | 2015-07-09T22:49:43 | Initial work on accepting generic patterns | diff --git a/src/full.rs b/src/full.rs
index e524296..1aecd09 100644
--- a/src/full.rs
+++ b/src/full.rs
@@ -18,17 +18,17 @@ use super::autiter::Automaton;
/// Namely, it will use at least `4 * 256 * #states`, where the number of
/// states is capped at length of all patterns concatenated.
#[derive(Clone)]
-pub stru... | 2 | 27 | 27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.