[Feature Request] Add Build Mode with Optimization and Debug Information
- Dominant language
- Python
- Stars
- 16.8k
- Forks
- 603
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 6
Description
## Summary
I would like to request a new build mode that combines optimization with debug information generation, similar to the `-O2 -g` or `-O3 -g` flags commonly available in other compilers.
## Current Behavior
Currently, Codon provides two build options:
- `--release`: Enables optimization but does not generate debug information
- `--debug`: Generates debug information but disables optimization
## Desired Behavior
I would like to have an additional build mode (e.g., `--release-with-debug` or `--relwithdebinfo`) that:
- Enables compiler optimizations (similar to `--release`)
- Generates debug symbols and debugging information (similar to `--debug`)
## Motivation
This feature would be valuable for several use cases:
1. **Performance Profiling**: When profiling optimized code, having debug symbols makes it much easier to identify performance bottlenecks with meaningful function names and line numbers. E.g. via perf, vtune or uprof
2. **Production Debugging**: When issues occur in production or performance-critical environments, having debug information in optimized builds allows for better post-mortem analysis without the performance penalty of unoptimized code.
3. **Development Workflow**: During development, it's often useful to test with optimizations enabled while still being able to debug effectively when issues arise.
## Proposed Solution
Add a new command-line flag such as:
- `--release-with-debug`, or
- `--relwithdebinfo`, or
- Allow combining flags like `--release --debug`
Alternatively, provide a more flexible configuration system that allows users to independently control optimization levels and debug information generation.
## Additional Context
This would bring Codon's build options more in line with industry-standard compiler toolchains and would greatly enhance the debugging and profiling experience for performance-critical applications.
Thank you for considering this feature request. I believe it would be a valuable addition to Codon's build system.
**If the maintainers are willing to accept this feature and can specify the preferred command-line parameter name, I would be happy to implement this feature and submit a pull request.**
Please let me know your thoughts on this proposal. Thank you for considering this request!
Best regards
Contributor guide
Assessment
This issue has not been assessed yet.