Objective: Analyze the codebase to identify areas that excessively consume resources like CPU, memory, or disk I/O. Provide insights to guide optimization efforts for more efficient resource utilization.
Instructions:
- Use profiling tools: Employ resource profiling tools to monitor and analyze CPU usage, memory allocation, and disk I/O during application execution.
- Identify resource-intensive operations: Pinpoint code blocks, functions, or processes that contribute most significantly to high CPU load, excessive memory consumption, or frequent disk accesses.
- Analyze memory management:
- Look for memory leaks, where objects are not properly released after they are no longer needed.
- Investigate areas with high object creation rates or large object sizes.
- Examine I/O operations:
- Identify areas with frequent file system reads or writes.
- Analyze if data can be cached or if I/O operations can be batched for better performance.
- Correlate resource usage with code: Connect the identified resource-intensive areas back to specific code segments, functions, or modules to guide optimization efforts.
Expected Output: A comprehensive report detailing:
- Code areas with high CPU usage, including call graphs and execution times.
- Memory allocation hotspots, including object sizes, allocation frequencies, and potential leaks.
- Disk I/O intensive operations and recommendations for reducing or optimizing them.
- Overall insights into the codebase's resource consumption patterns and areas for potential improvement.