mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 03:34:25 +03:00
Rose: allow block-mode merge of small prefixes
Previously, we disallowed the merging of all Rose prefixes in block mode where the literal sets are not identical. This change allows merging if the prefix graphs to be merged are very small, as a small performance improvement for cases with lots of tiny prefixes. This check is deliberately conservative: graphs must have some common vertices, and the result of the merge must not give up any accelerability.
This commit is contained in:
committed by
Matthew Barr
parent
670eff5bc0
commit
7b54856642
@@ -2187,7 +2187,7 @@ u32 countAccelStates(NGHolder &h,
|
||||
|
||||
if (!cc.grey.allowLimExNFA) {
|
||||
DEBUG_PRINTF("limex not allowed\n");
|
||||
return NFA_MAX_ACCEL_STATES + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Sanity check the input data.
|
||||
@@ -2201,11 +2201,11 @@ u32 countAccelStates(NGHolder &h,
|
||||
do_accel, state_compression, cc, num_states);
|
||||
|
||||
// Acceleration analysis.
|
||||
fillAccelInfo(bi);
|
||||
nfaFindAccelSchemes(bi.h, bi.br_cyclic, &bi.accel.accel_map);
|
||||
|
||||
u32 num_accel = verify_u32(bi.accel.accelerable.size());
|
||||
u32 num_accel = verify_u32(bi.accel.accel_map.size());
|
||||
DEBUG_PRINTF("found %u accel states\n", num_accel);
|
||||
return min(num_accel, (u32)NFA_MAX_ACCEL_STATES);
|
||||
return num_accel;
|
||||
}
|
||||
|
||||
} // namespace ue2
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -79,11 +79,10 @@ aligned_unique_ptr<NFA> generate(NGHolder &g,
|
||||
const CompileContext &cc);
|
||||
|
||||
/**
|
||||
* \brief For a given graph, count the number of accel states it will have in
|
||||
* an implementation.
|
||||
* \brief For a given graph, count the number of accelerable states it has.
|
||||
*
|
||||
* \return the number of accel states, or NFA_MAX_ACCEL_STATES + 1 if an
|
||||
* implementation would not be constructible.
|
||||
* Note that this number may be greater than the number that are actually
|
||||
* implementable.
|
||||
*/
|
||||
u32 countAccelStates(NGHolder &h,
|
||||
const ue2::unordered_map<NFAVertex, u32> &states,
|
||||
|
Reference in New Issue
Block a user