math.Approach Optimization #1187

Merged
merged 1 commit into from Jul 22, 2016

Projects

None yet

5 participants

@thegrb93
Contributor

Slight optimization to this function which is called very frequently. I recorded 25% speed increase. If the math functions were made local then it would be a 40% speed increase.

@meepdarknessmeep
Contributor

this isn't even an optimization - it completely changes how it works

@thegrb93
Contributor

No it doesn't. Explain what makes you think that.

@thegrb93
Contributor

You and robotboy need to practice your math skills.

@Kefta
Contributor
Kefta commented Jun 15, 2016 edited

It does. For example, math.Approach( 100, 101, -50 ). Before, that would return 100, but it would return 50 with your change. I know it's a bit illogical to use math.Approach that way in the first place, but it was a previous behaviour.

@Kefta
Contributor
Kefta commented Jun 15, 2016

Oh, damn. @thegrb93 is right

@robotboy655
Collaborator

It's not about math skills, its about the one line GitHub chose to omit.

@robotboy655 robotboy655 reopened this Jun 15, 2016
@robotboy655 robotboy655 merged commit 146d5f9 into garrynewman:master Jul 22, 2016
@thegrb93 thegrb93 deleted the thegrb93:optimize_math_approach branch Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment