4

I have a program that stores some user options in the registry (about 5 options). The options are fetched from the registry within an inline function. The options need to be checked several times during run time. More specifically, the options are checked inside a function that may be called upwards of a 100 times during one routine.

My question is which would be more efficient: 1) Call the inline function which gets the option from registry every time the option needs to be checked; or 2) Call the inline function once and then store the result in a static variable, which will then be used to check the option.

Please note that I am not concerned with options being changed during run time as they are rarely changed and do not need to take effect until the next run of the program.

Any feedback would be highly appreciated.

4

2 に答える 2