/*
- * Copyright (c) 2015-2018, Intel Corporation
+ * Copyright (c) 2015-2020, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
bytecode_ptr<NFA> nfa;
if (!using8bit) {
+ // Wide state optimization
if (cc.grey.allowWideStates && strat.getType() == McClellan
&& !is_triggered(raw.kind)) {
find_wide_state(info);
bool any_cyclic_near_anchored_state
= is_cyclic_near(raw, raw.start_anchored);
- for (u32 i = 0; i < info.size(); i++) {
- if (info.is_widestate(i)) {
- continue;
+ // Sherman optimization
+ if (info.impl_alpha_size > 16) {
+ for (u32 i = 0; i < info.size(); i++) {
+ if (info.is_widestate(i)) {
+ continue;
+ }
+ find_better_daddy(info, i, using8bit,
+ any_cyclic_near_anchored_state,
+ trust_daddy_states, cc.grey);
+ total_daddy += info.extra[i].daddytaken;
}
- find_better_daddy(info, i, using8bit,
- any_cyclic_near_anchored_state,
- trust_daddy_states, cc.grey);
- total_daddy += info.extra[i].daddytaken;
- }
- DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
- info.size() * info.impl_alpha_size, info.size(),
- info.impl_alpha_size);
+ DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
+ info.size() * info.impl_alpha_size, info.size(),
+ info.impl_alpha_size);
+ }
nfa = mcclellanCompile16(info, cc, accel_states);
} else {
/*
- * Copyright (c) 2016-2017, Intel Corporation
+ * Copyright (c) 2016-2020, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
assert(info.getAlphaShift() <= 8);
- u16 total_daddy = 0;
- for (u32 i = 0; i < info.size(); i++) {
- find_better_daddy(info, i,
- is_cyclic_near(info.raw, info.raw.start_anchored),
- grey);
- total_daddy += info.extra[i].daddytaken;
- }
+ // Sherman optimization
+ if (info.impl_alpha_size > 16) {
+ u16 total_daddy = 0;
+ for (u32 i = 0; i < info.size(); i++) {
+ find_better_daddy(info, i,
+ is_cyclic_near(info.raw, info.raw.start_anchored),
+ grey);
+ total_daddy += info.extra[i].daddytaken;
+ }
- DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
- info.size() * info.impl_alpha_size, info.size(),
- info.impl_alpha_size);
+ DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
+ info.size() * info.impl_alpha_size, info.size(),
+ info.impl_alpha_size);
+ }
u16 sherman_limit;
if (!allocateImplId16(info, sheng_end, &sherman_limit)) {