-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Health: Optimize C++ Code for performance #6368
Comments
I'm pretty sure that most points on that article (1, 2, 4, 5, 6, 7 and 10) are wrong because the compiler can already do them automatically. |
It's also from 2015 so I wouldn't be surprised if some things changed. It's good the compiler can do some stuff for us but we eventually want to be cross-platform. It might be better to be explicit so we don't have to rely on the compiler. Regardless, using fast_io will still be better than any compiler optimizations (at least until it's included like fmt is into the standard). |
Thanks for filing this! I'd prefer to keep track of performance issues at a finer scale than this, however. Performance informs everything we do, and I'm not ready to declare a flag day where the five of us sit down and pore over perf traces and rewrite large swaths of code based on those numbers. When we find hot spots, we'll file them. When we don't find hot spots, we look for better and better corpuses of data so that we can find hot spots. Only from there can we file workitems to drive those hot spots back down. 😄 Closing for now, but I'd like to retain this as a discussion issue. |
I was thinking of this as a master issue from which, we could file smaller issues as you've said that are tracked here. When I have some time, I'll be looking for a spot where I can introduce some optimized code using fast_io and bring the dep in with that as an example where we could use it. Of course somebody else can beat me to it and that won't bother me at all. Best place I can think of currently is where we actually have used fmt, which should provide some gain though not as much as somewhere in the code that hasn't been optimized at all. |
Description of the new feature/enhancement
As discussed in #6350, we do not appear to be optimizing our C++ code to run faster I/O (while still maintaining safety). We should optimize code using iostream and other related header libraries but preferably with fast_io, which is fastest currently in existence, which aims to become part of the C++20 standard. https://www.thegeekstuff.com/2015/01/c-cpp-code-optimization/ is a general guide on how to optimize our code. https://github.com/expnkx/fast_io/wiki provides specific examples for different types of operations that can be optimized using fast_io.
Proposed technical implementation details (optional)
Start by merging adding #5152 and #5080 but those will provide only small benefit. Otherwise use the fast_io wiki to help optimize code as PRs are created if relevant to the PR. Depends on: #6350 being implemented.
The text was updated successfully, but these errors were encountered: