From Wowpedia
Jump to: navigation, search

Performance concerns

Interesting function, but the cost of a table per call is a big turnoff. Also, in your examples you're using locals anyway, so effectivly all you've done is create a garbage table and added the execution time of an extra function call. Tell me what the problem is with doing this the cheap and fast way:

local sName, _, iRarity, _, _, sType, _, iStackCount = GetItemInfo(16846)

User:Tekkub/Sig 03:09, 18 July 2007 (UTC)

Sorry, make that a cost of 2 tables and in many cases a new string as well. User:Tekkub/Sig 03:10, 18 July 2007 (UTC)
Every Frame in the game is a table, 2 itty bitty tables aren't going to hinder performance that much, are they? Then again, subsequent calls to the function create more tables... I've added a variant that widens the scope a little, perhaps that would be a little less expensive. P.S. I'm a lazy lazy programmer and typing all those commas and underscores doesn't appeal to that general sense of laziness. Egingell 06:46, 18 July 2007 (UTC)
Garbage is garbage, it should be avoided. Every time your function is called it wastes memory needlessly. The more you use this, the more time you blow on GC, all because you didn't want to type a few commas. I understand lazy, I'm super lazy, but I don't let my laziness cost my addon's performance. User:Tekkub/Sig 08:34, 18 July 2007 (UTC)