Edit: Oh, as for the actual question... if the function calling GetSomeField does anything remotely complicated, the overhead from a method call is probably insignificant. Eg. each string concatenation amounts to way more cycles than a method call. Still, why not call it once and store it to a local variable...
Just what I was worrying over, if your going to have the method to get and set fields/properties, and it is faster to not use them so often, why bother localizing the field? Won't that just add to the memory? In that case it would make more sense to just access the fields directly.
The only reason I prefer using methods for get/set is because in the future it might be necessary to do some operations before setting/getting the given field, or if things need to be changed internally with the field, the code already in place usually doesn't need to be changed.
Your calling the same method twice..
Also, because the field value is 0 its very fast
if the default field value is something else is much slower.
Like I said, that isn't exactly what I'm doing.. Sometimes fields need operations/post operations when you get/set them (which you would obviously have to use), sometimes they just return or set the field.
Here are some of the methods in one of the duct modules (not committed yet)
Method GetCharCount:Int()
Return GetText().Length
End Method
Method TextDelete()
If GetCursorPosition() < GetCharCount()
RemoveText(GetCursorPosition(), GetCursorPosition() + 1)
End If
End Method
Method InsertTextAtIndex(_text:String, _index:Int, _setpos:Int = True)
SetText(GetText()[0.._index] + _text + GetText()[_index..GetCharCount()], False)
If _setpos = True Then SetCursorPosition(_index + _text.Length)
End Method
etc.
EDIT: And not only for text operations and the such, I have positional fields that mostly need to be set with operations, thus I use the given field a lot in the set/update/refresh method for the positional field.