   The importance of Pre-Caching function handles.
  I know it was mentioned in the documentation that handles to functions should be pre-cached whenever possible, but I had absolutely no idea just how big of an impact it would have on performance.As a bit of background, my engine has had a bottleneck that rears its ugly head when many objects are created and then destroyed.One of the things I found out while I have been working is that when dealing with multiple instances of a particular class (such as the case with Mengi and the "Updatable") handles will differ on an instance-to-instance basis. As a result, in a fit of lazyness I would presume, I decided that I should grab the Update function ID for an Updatable script object on the fly in the update loop.I am going to stop here and let the cachegrind results speak for themselves. Relevant part is highlighted in blue. The results with pre-caching are on the left, no pre-caching on the right.
  I had similar drastic improvements when I started cashing all my GetTypeIdByDecl calls. I didn't do any benchmarking but I could tell just by running scripts that would previously make heavy use of these calls, just how much of an improvement in performance there was. Always makes me wonder why I didn't do this right from the start... Guess I've learned my lesson.Kind regards,Philip Bennefall   ;  Thanks for sharing.The methods that are used to look up function id's and type id's etc are very heavy, as they need to do a lot of comparisons to find the correct function/type that is being looked for. Also, based on the fact that the results of these functions should be cached when possible I haven't really spent a lot of time in optimizing them. There are for example quite a bit of naïve linear searches and string comparisons in these functions at the moment.   