Re: [RFC][PATCH 08/12] tracing/filter: Optimize short ciruit check
From: Steven Rostedt
Date: Fri Jan 28 2011 - 00:37:34 EST
On Thu, 2011-01-27 at 23:21 -0500, Steven Rostedt wrote:
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index 2677924..afe59ab 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -426,9 +426,15 @@ int filter_match_preds(struct event_filter *filter, void *rec)
> pred->parent, &move);
> continue;
> case MOVE_UP_FROM_LEFT:
> - /* Check for short circuits */
> - if ((match && pred->op == OP_OR) ||
> - (!match && pred->op == OP_AND)) {
> + /*
> + * Check for short circuits.
> + *
> + * Optimization: !!match == (pred->op == OP_OR)
> + * is the same as:
> + * if ((match && pred->op == OP_OR) ||
> + * (!match && pred->op == OP_AND))
> + */
> + if (!!match == (pred->op == OP_OR))
+ {
Bah! I tested these in quilt and when I pulled them into git, I must
have accidentally deleted the '{' in the patch :-p
Thanks goodness this was only a RFC ;)
/me goes to rebase
-- Steve
> if (pred == root)
> break;
> pred = get_pred_parent(pred, preds,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/