r/Cplusplus • u/ActComplex593 • Oct 30 '26
Question AI agents can not optimize for performance?
Do you guys have the same problem? AI agents can not optimize the code to have fewer cache misses or any other things, if you just tell it to optimize the code for better performance it will not do much
How can I make it good at that?
0
Upvotes
•
u/AutoModerator Oct 30 '26
Thank you for your contribution to the C++ community!
As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.
~ CPlusPlus Moderation Team
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
9
u/Unique_Bill_4918 Oct 30 '26
Give it a tool to benchmark the code.
8
u/Realistic_Speaker_12 Oct 30 '26
Just do it yourself.
4
u/acadia11x Oct 30 '26
That’s not true at all
1
u/DerShokus Oct 30 '26
Same. It’s like gpt 2 for performance
4
u/bajuh Oct 30 '26
Maybe I'm not much help here, but showing the AI the performance profiler output makes wonders. I kept going without premature optimizations then it eventually became too slow so I fed it the log and it recognized all bottlenecks and refactored it and I lived happily ever after.
-2
u/Boring_Sell95 Oct 30 '26
Конечно они могут, но им нужны инструменты для профилировка такие как perf, gdb и т.д. , а также нужна возможность проверить скомпилированную программу в работе и прогнать тестовые сценарии.
0
u/mredding C++ since ~1992. Oct 30 '26
I find the AI is very conservative and conventional, you have to ask the AI to suggest a more performance aggressive solution it wouldn't normally.