View Single Post
09-25-16, 07:38 AM   #19
EyalSK
A Deviate Faerie Dragon
 
EyalSK's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 13
If you have concrete pointers to where I can improve the performance of the generated LUA code, I'd be delighted to hear them.
Well, the generated code you posted is purely data so it all depends on how you process it and you didn't provide it but I'd really try to keep the amount of tables and lookup down as much as possible, I don't think the generated code needs to have 1:1 or high fidelity with the source code especially if you aim for performance first therefor you can get rid of some things, for example,

Code:
{ 
						SmallButton, 
						{ 
							anchors = { 
								{ "BOTTOMLEFT" } 
							}, 
							onClick = function()
			self:ok()
		end
						}, 
						{ 
							Text, 
							{ 
								anchors = "*" 
							}, 
							"OK" 
						} 
					},
Can become the following.

Code:
{ 
	SmallButton, 
	{ 
		anchors = "BOTTOMLEFT", 
		onClick = function()
			self:ok()
		end
	}, 
	{ 
		Text, 
		anchors = "*", 
		"OK" 
	} 
},
But then again, this is just a hunch because this change might complicate the rendering logic and buy nothing so to really provide insights to how you can improve performance one needs to know the full story beyond the generated code.

Code:
How would you go around creating a UI component library/anything in LUA that allows you to do exactly this (with exactly I don't mean JSX markup, but the parenting/anchoring nightmare)?
Not sure what you're asking here or maybe it was just rhetorical.

p.s. Just a minor note Lua isn't an acronym but a word so you actually need to write Lua instead of LUA.

Last edited by EyalSK : 09-25-16 at 07:50 AM.
  Reply With Quote