I have recently begun using more getter functions as opposed to direct access to make my code more flexible. I am curious what the cost of this is in terms of speed. Suppose that earth
is an object and we have the following parent object:
var star={}
star.planet=earth
star.getPlanet=function(){
return this.planet
}
Is there a non-negligible difference in speed between the following two statements?
print(star.planet)
print(star.getPlanet())