Performance: Custom agent logic
MEDIUM IMPACT
Custom agent logic affects how quickly and efficiently the agent processes inputs and generates outputs, impacting interaction responsiveness and overall user experience.
def agent_decision(input): cache = {} def get_result(key): if key not in cache: if key in ['A', 'B']: cache[key] = complex_call_1() elif key == 'C': cache[key] = complex_call_2() else: cache[key] = complex_call_3() return cache[key] return get_result(input)
def agent_decision(input): # Multiple nested if-else checks with redundant calls if input == 'A': result = complex_call_1() elif input == 'B': result = complex_call_1() elif input == 'C': result = complex_call_2() else: result = complex_call_3() return result
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Redundant heavy calls in logic | Minimal | 0 | Low | [X] Bad |
| Cached and simplified logic | Minimal | 0 | Low | [OK] Good |