Description
Add a caching mechanism that stores IDL parse results and generated files to avoid redundant processing when IDL files haven't changed.
Motivation
As discussed in #859, building packages with many IDL files takes significant time.
In CI environments, IDL files rarely change between builds, making caching effective. While the C/C++ compilation phase can be accelerated using ccache/sccache, the file generation phase still takes time.
This proposal addresses the file generation bottleneck by caching:
- Parsed IDL results
- Generated source files from each rosidl generator
Design / Implementation Considerations
No response
Additional Information
I created a prototype implementation to validate this approach:
https://github.com/otamachan/rosidl/tree/introduce-cache
Cache key is computed from:
- IDL file content(SHA256)
- Template files content
- Generation context (package name, output mapping, etc.)
Performance test with px4_msgs (~100 IDL files):
- CPU: Intel Core i9-14900K (24 cores)
- Build: ninja build with -j8
| Scenario |
Build Time |
| No cache |
2m 30s |
| ccache only |
1m 48s |
| ccache + rosidl cache |
3.5s |
Cache size: ~72MB (rosidl) + ~35MB (ccache)
No cache:
ccache only:
ccache + rosidl cache:

Description
Add a caching mechanism that stores IDL parse results and generated files to avoid redundant processing when IDL files haven't changed.
Motivation
As discussed in #859, building packages with many IDL files takes significant time.
In CI environments, IDL files rarely change between builds, making caching effective. While the C/C++ compilation phase can be accelerated using ccache/sccache, the file generation phase still takes time.
This proposal addresses the file generation bottleneck by caching:
Design / Implementation Considerations
No response
Additional Information
I created a prototype implementation to validate this approach:
https://github.com/otamachan/rosidl/tree/introduce-cache
Cache key is computed from:
Performance test with px4_msgs (~100 IDL files):
Cache size: ~72MB (rosidl) + ~35MB (ccache)
No cache:
ccache only:
ccache + rosidl cache: