Hi, On 09/08/2010 07:35 AM, Taco Hoekwater wrote:
In punknova.kern, there tend to be 1242 top-level kern array entries, each of which has about a little under a hundred keys. That would be over 100k worth of metatable lookups, and that will definitely be slower than accessing the actual table that is returned at the moment.
Also, each of those metatable calls would introduce a new userdata object to be garbage collected. Hans and I just did some tests, and it seems that the userdata access is useful if *but only if* you are very low on memory. In other cases, it just adds extra objects to be garbage collected, which makes the collector slower. That is on top of extra time spent on the actual calls, and even worse: those extra gc objects tend to be scattered around in memory, resulting in extra minor page faults (cpu cache misses) and all that has a noticeable effect on run speed: the metatable-based access is 20-30% slower than the old massive to_table. Therefore, there seems little point in expanding the metadata functionality any further. What is there will stay, but adding more metadata objects appears to be a waste of time on all sides. Best wishes, Taco