Variables or repeated function calls?
Posted: Wed Jan 23, 2019 3:39 am
Generally, you want to avoid repeated function calls. For example, if your string processing calls for repeatedly using the length of the string, you call Len(string) once, save the result in a variable, and then use the value in the variable instead of calling Len(string) over and over. This makes sense, especially if you're dealing with an complex object model in which you have to invoke methods five levels deep to get anything done.
But I was wondering if PureBasic is lean enough that the overhead of calling a function like GetCurrentDirectory() or GetGadgetText() is low enough that it's not worth it to create a variable and assign the result to it. I know some forum members are handy with a disassembler, so I guess they would know this.
But I was wondering if PureBasic is lean enough that the overhead of calling a function like GetCurrentDirectory() or GetGadgetText() is low enough that it's not worth it to create a variable and assign the result to it. I know some forum members are handy with a disassembler, so I guess they would know this.
