Analyzing very large code bases can place significant demands on system resources. The following best practices can help improve performance, reduce analysis time, and avoid unnecessary overhead when working with large projects.
System Resources and Project Setup
Adequate system memory is critical for large-scale analysis. As a general guideline, plan for approximately 1 GB of RAM per million lines of code. Systems with insufficient memory may experience slow parsing, long report generation times, or instability.
Source code can be stored on a network drive, but the project database (the .und file) should always be kept on a local disk. Storing the database locally minimizes I/O latency and improves overall performance during parsing and analysis.
Quick Tips:
Allocate additional RAM whenever possible.
Keep the .
undfile on a fast local drive (SSD recommended).
Parsing Large Systems
For extremely large projects (approximately 8 million source lines of code or more), parsing in the GUI may be inefficient. In these cases, use the 'und' command-line parser to run parsing jobs in batch mode. Scheduling these jobs overnight or during off-hours allows the analysis to complete without impacting daily work.
Quick Tips:
Use the 'und' command-line tool for very large projects.
Run parsing jobs overnight or during low system usage.
Report Generation Strategy
Not all reports and plugins are equally expensive to generate. Carefully consider which of them are truly needed and avoid enabling or generating those that provide limited value. The Invocation Tree report, for example, can consume significant memory and processing time on large systems.
Reports can also be automated using 'und', allowing them to run automatically during off-hours.
Quick Tips:
Generate only the reports you need.
Automate report generation with '
und'and run it overnight.
Limiting Analysis Scope
Useful insights can often be obtained without analyzing every source file in full detail. For C and C++ projects, consider providing only header files in areas where implementation-level analysis is not required. For Ada projects, supplying specification files alone may be sufficient in some cases.
For C and C++ projects focused on high-level architecture, you can also disable references to local objects, parameters, and inactive code in the project configuration to reduce analysis overhead.
Quick Tips:
Use headers or specs when full implementation details are unnecessary.
Disable analysis of local objects and inactive code when focusing on architecture.
Reducing analysis scope can significantly improve performance.
In Summary...
Large code bases require thoughtful configuration and resource planning. Adequate memory, local database storage, selective parsing, and careful report selection all contribute to faster, more reliable analysis. When in doubt, remember: more RAM and a more focused analysis go a long way toward better performance.
