View Single Post
  #18  
Unread 10-08-2010, 07:23 PM
Kryso Kryso is offline
The Undefeated
 
Join Date: Oct 2010
Posts: 8
As I posted earlier - it's really small thing. You probably won't run into problems with too high memory usage, unless you work with tons of images that are currently bugged. I personally prefer to create events within constructor because of "self" reference from parent scope. There won't be any problems with memory, until you create new function many times per second or create enormous amount of instances - but you generally want to keep your application as clean as you can. Also I don't know how often lotro client collects garbage in lua - in wow it was once a few minutes, so even non-statistical addons could easily eat megabytes of memory sometimes. Good example would be some bufftimer - if you are going to create new object with buttload new functions on every update and not cache anything you will eat huge amount of memory in some situations. Also creating function doesn't eat only memory, but also processor time, but again it's really small thing.

To sum it up, feel free use all features of language even at expense of some performance, but be smart. Good trade is when you get something back from the performance loss, bad thing is throw performance away and not get anything from it. As example take this: http://forums.lotro.com/showthread.p...proved-classes
Sure, there is some performance loss because of function call on __index and __newindex but hey, I won't spend hours of debugging because I forgot to call base constructor ever again ;p
Reply With Quote