Performance problem in FunctionEvaluator

Bug #348163 reported by Steve Rogers
2
Affects Status Importance Assigned to Milestone
VMod Framework
Fix Committed
Undecided
fivemile

Bug Description

FunctionEvaluator calls the evaluate method on the Evaluator 3 times, once to check for null, once for logging and once to return the data.
Should only call this once
Currently
if(evaluator.evaluate(t) == null) {
                ValidationRuntimeException vre = new ValidationRuntimeException("evaluator evaluates to null");
                logger.throwing("FunctionEvaluator", "evaluate", vre);
                throw vre;
}

Method m = evaluator.evaluate(t).getClass().getMethod(methodName, argTypes);
X result = (X) m.invoke(evaluator.evaluate(t), args);

Could be
X evaluatedResult = evaluator.evaluate(t);
if(evaluatedResult == null) {
                ValidationRuntimeException vre = new ValidationRuntimeException("evaluator evaluates to null");
                logger.throwing("FunctionEvaluator", "evaluate", vre);
                throw vre;
}

Method m = evaluatedResult.getClass().getMethod(methodName, argTypes);
X result = (X) m.invoke(evaluatedResult, args);

Revision history for this message
fivemile (fivemilesolutions) wrote :

Accepted bug

Changed in vmod-framework:
assignee: nobody → fivemilesolutions
status: New → Confirmed
Revision history for this message
fivemile (fivemilesolutions) wrote :

Commited to v1.1 revision 21

Changed in vmod-framework:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.