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
Remove some dead code (maybe a merge defect?) #6701
Remove some dead code (maybe a merge defect?) #6701
Conversation
bencsikandrei
commented
May 12, 2022
- small formatting changes
- small rearrange
There's a couple of other changes that could be made in these files. But I need some guidance, please, whether you'd like me to try them out or not. One example is the class layout. As it is now, if I counted correctly, on a 64 bit arch the animated class takes 72B (it's virtual so, 8 bytes bonus) Some small rearrangements, like so: Takes it down to 64, which fits a cache line. Other things can be envisioned, like double -> float, but the alignment requirements will make it so that that doesn't help. Maybe some of the ints (4B) can be smaller ints? Maybe I'm going too far :D Is this something of interest? Have a good one! |
In the same spirit as another PR I made, maybe a separate PR with replacing |
cycles_ = cycles; | ||
if(acceleration_ <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is pretty late here, but I'm not missing something here, right?
animated is set to 1, at line 80, then never changed and then checked for <= 0
I guess it was a simple merge request gone weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your change looks good to me. Looks as if this should have been removed in 20bf7fa, when this function stopped taking the acceleration as a parameter.
src/animated.tpp
Outdated
@@ -130,7 +126,7 @@ inline void animated<T>::update_last_draw_time(double acceleration) | |||
} | |||
|
|||
if(get_current_frame_end_time() < get_animation_time() && // catch up | |||
get_current_frame_end_time() < get_end_time()) { // don't go after the end | |||
get_current_frame_end_time() < get_end_time()) { // don't go after the end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put these two conditions on one line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
While optimizations are good, I'd say this is overkill unless the performance improvements are measurable in some way. |
Did we have a policy regarding braces on if statements? I forget. It's not that I'm opposed to adding them there, mind you… just mixing style changes with not-style changes is something I prefer not to happen. Although… these may not be style changes but they are basically non-functional changes, other than making the constructor explicit.
Or to put it another way… profile it. |
@Pentarctagon I'll try to see the impact it has. If the struct is used very often or some vector if it iterated often it's probably worth it @CelticMinstrel I didn't mean to change that one @Pentarctagon @CelticMinstrel if you have some quick tips on how I can benchmark effectively and be quick about, I'd highly appreciate it, otherwise I'm gonna continue on my road to knowing the project and will figure it out eventually :D Thanks! I'll make the changes you suggested ASAP, thanks for the feedback! |
Just FTR, I don't mind adding the braces there… if I'm hesitant of anything, it's adding them in the same commit (or PR?) as this other stuff. It's only one change, so it's not that big a deal, but still. |
@bencsikandrei There's profiler support in cmake and scons if you're on Linux, otherwise I don't have any advice on it though. |
ee74768
to
7607be6
Compare
* small formatting changes * small rearrange
7607be6
to
4476ee4
Compare