Generate separate mod files in the ros2 msg-gen for better compiling time#1182
Generate separate mod files in the ros2 msg-gen for better compiling time#1182phil-opp merged 10 commits intodora-rs:mainfrom
Conversation
divide msgs from different packages into different files to take advantage of rust's incremental compiling. Signed-off-by: drindr <dreamchancn@qq.com>
use separate package mod for cxx api Signed-off-by: drindr <dreamchancn@qq.com>
Signed-off-by: drindr <dreamchancn@qq.com>
Signed-off-by: drindr <dreamchancn@qq.com>
Signed-off-by: drindr <dreamchancn@qq.com>
the alias have been moved into the mod. the hand-writing mod block can be removed. Signed-off-by: drindr <dreamchancn@qq.com>
Signed-off-by: drindr <dreamchancn@qq.com>
phil-opp
left a comment
There was a problem hiding this comment.
Thanks a lot! I haven't had time for a in-depth review, but this seems like a nice improvement. The generated files and the separation into different modules certainly looks much cleaner now. I also did some basic tests and everything seems to be still working as expected.
|
Could you resolve the conflicts with
Yes, it is. It's been a while since I wrote the code so I don't remember what part of the compilation requires most time. Is it just the amount of Rust code that is generated or is the bottleneck somewhere else? |
Signed-off-by: drindr <dreamchancn@qq.com>
|
Thanks again! |
The bottleneck is from the The |
|
Thanks for the info! Could you also time a build of the I also just noticed that cargo seems to rebuild the |
One part of the issue was a recent change in the I opened #1189 to fix this (and also remove another incorrect |
|
I apply the same 2 timing process mentioned before for the crate
The result is
|
- Update `cxx` crate to 1.0.188 to include dtolnay/cxx#1668 - Remove `rerun-if-changed` for autogenerated file (which always caused rebuild) - Rerun build script if the `DORA_NODE_API_CXX_INSTALL` env variable changes Discovered in #1182 (comment)
This PR generate separate mod files for ros2 msg and reduce the cross-reference between mods.
Tested on my laptop with
--timingsflag, the 1st compiling time of dora-ros2-bridge is 2~3 secs slower than the single file implementation.And as I source a new ros2 interfaces package, with incremental compiling, the compiling time is 6~8 secs faster than the original one.
The change of code-generate time is less than 1 sec according to the report.
In the 1st compilation, I just source the system's ros2 workspace.
In the 2nd compilation, I add a new customize interface package.
In the 3rd compilation, I remove the customize interface package added in the 2nd compilation.
And for c++ users, they can just compile and include the specific header they need, which increases the complexity (more flags) but can reduce the c++'s compiling time (not tested yet).
The compiling time of ros2-bridge is still very long. I'm not sure if it's still worthy to push ahead.