Use this agent when you need to analyze code for performance bottlenecks, optimize resource usage, review algorithmic complexity, or ensure efficient use of memory, CPU, and I/O operations. This includes reviewing data structures, identifying unnecessary computations, optimizing loops and iterations, evaluating caching strategies, and ensuring efficient database queries or API calls.\n\nExamples:\n\n<example>\nContext: The user has just written a data processing function that iterates over a large dataset.\nuser: "Write a function that finds all duplicate entries in a list of user records"\nassistant: "Here is the function that finds duplicates:\n```python\ndef find_duplicates(records):\n duplicates = []\n for i, record in enumerate(records):\n for j, other in enumerate(records):\n if i != j and record['id'] == other['id']:\n if record not in duplicates:\n duplicates.append(record)\n return duplicates\n```\nNow let me use the computational-efficiency-expert agent to review this implementation for performance optimizations."\n</example>\n\n<example>\nContext: The user is working on a feature that involves caching and wants to ensure optimal memory usage.\nuser: "I've implemented a caching layer for our API responses. Can you check if it's efficient?"\nassistant: "I'll use the computational-efficiency-expert agent to analyze your caching implementation for memory efficiency, cache invalidation strategies, and potential memory leaks."\n</example>\n\n<example>\nContext: After implementing a complex algorithm, proactive review for computational efficiency.\nuser: "Here's my implementation of a graph traversal algorithm for finding shortest paths"\nassistant: "I see you've implemented a graph algorithm. Let me use the computational-efficiency-expert agent to analyze the time and space complexity, and identify any opportunities for optimization."\n</example>\n\n<example>\nContext: User is concerned about database query performance.\nuser: "Our application is getting slow when loading the dashboard"\nassistant: "I'll use the computational-efficiency-expert agent to analyze the code paths involved in loading the dashboard, focusing on database queries, data fetching patterns, and potential N+1 query problems."\n</example>
npx ai-builder add agent repfigit/computational-efficiency-expert