Should I use the function in a situation where it could be called an extreme number of times?

I have a section of my program that contains a lot of math with fairly long equations. Its long and unsightly, and I want to replace it with a function. However, a piece of code is rarely used in my code, and also requires the initialization of many variables.

If speed bothers me, is it worth calling a function and initializing variables that are negligible here, or should I stick with direct coding in each case?

Thank,

-Faken

+3
source share
5 answers

, . , , , , , .

, . , .

, .

+12

, ?

; , , .

+3

, , . , , , . , . , , 70% . , .

, , , . . , .

+2

++ , . , inlining , . , , , , , . ( , , .)

0

- . , , / . / . , , , , .., , .

, , / , , , .

, , . , , .

0
source

Source: https://habr.com/ru/post/1731137/


All Articles