Quantcast function "has more then 60 upvalues" - Page 2 - WoWInterface
Thread Tools Display Modes
04-18-09, 12:51 AM   #21
ChaosInc
Curse staff
 
ChaosInc's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 672
Originally Posted by Azul View Post
Tables are to slow. If there's a decent (not function call, like the extremely slow bit library) way to do bitwise operations in it, I think I could bring the variable count down enough to placate this arbitrary limitation. I don't know how though. All I could find was that uselessly slow bit function library. Any ideas?
No clue. Honestly, this is the first time I've ever heard of someone needing to mess with 60+ things on each OnUpdate, which makes me rather curious at what you're trying to build.
 
04-18-09, 12:55 AM   #22
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
I'm rather curious what this limit is for, and why there is nothing I can call to disable it.
 
04-18-09, 01:00 AM   #23
Aezay
A Theradrim Guardian
 
Aezay's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 66
What makes you think that tables are too slow? Sure it's true that locals are faster, but when working with data, which I think you do, as you're able to use up 60 upvalues, it makes a lot more sense to put it into tables.
If you want us to really be able to help you, the code has to be posted, no pseudo code, the real stuff.
 
04-18-09, 01:02 AM   #24
ChaosInc
Curse staff
 
ChaosInc's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 672
Originally Posted by Azul View Post
I'm rather curious what this limit is for, and why there is nothing I can call to disable it.
Blizz's restriction to limit OnUpdate overhead. Too much going on = too much processing, both on the user end and on the servers. You have to take into account that although a user may not mind a bit of lag here and there during data transactions, it does effect gameplay for everyone else as well. About a month ago people ran into this issue where half the players running around where "jerking" or "teleporting" due to inproperly throttled performance monitor mods (not going to state any specfic ones).

As a rogue, I know this irritated the hell outta me when I would try to sneak on someone to find that they were actually 200 yrds in the opposite direction because a mod they had was trying to do too much too quickly.

But that's it for me tonight. I'm well past my bedtime and have to work in the morn. GL with your project.
 
04-18-09, 01:05 AM   #25
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by ChaosInc View Post
Blizz's restriction to limit OnUpdate overhead. Too much going on = too much processing, both on the user end and on the servers. You have to take into account that although a user may not mind a bit of lag here and there during data transactions, it does effect gameplay for everyone else as well. About a month ago people ran into this issue where half the players running around where "jerking" or "teleporting" due to inproperly throttled performance monitor mods (not going to state any specfic ones).

As a rogue, I know this irritated the hell outta me when I would try to sneak on someone to find that they were actually 200 yrds in the opposite direction because a mod they had was trying to do too much too quickly.

But that's it for me tonight. I'm well past my bedtime and have to work in the morn. GL with your project.
I think the lag will be worse if I use globals instead of locals. Your (or their) logic is completely flawed. At the most fundamental level possible.


Originally Posted by Aezay View Post
What makes you think that tables are too slow? Sure it's true that locals are faster, but when working with data, which I think you do, as you're able to use up 60 upvalues, it makes a lot more sense to put it into tables.
If you want us to really be able to help you, the code has to be posted, no pseudo code, the real stuff.
Because I tried with tables, and it was much slower. I don't want to post my code in the state it's in right now, it would be very embarrassing.
 
04-18-09, 01:09 AM   #26
ChaosInc
Curse staff
 
ChaosInc's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 672
Originally Posted by Azul View Post
Because I tried with tables, and it was much slower. I don't want to post my code in the state it's in right now, it would be very embarrassing.
I assure you, it can't be worse than my first projects starting out.

(Ok, I'm really going now)
 
04-18-09, 01:23 AM   #27
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
why not declare your upvalues outside of the OnUpdate so that you don't have to mess with the locals inside of it

Code:
local frame=CreateFrame("Frame")
local foo,bar,text
frame:SetScript("OnUpdate",function(self)
	if not foo then 
		foo,bar,text="foo","bar",""
	end
	text=foo..bar
end)
this way you dont mess with globals and you retain the info between onupdates

also 60 upvalues is a tonne can you post your code and maybe we can find a better solution all together?
 
04-18-09, 01:26 AM   #28
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
What about creating the variables outside the OnUpdate function and then change the values?

As such:
Code:
local var
local foo
local crap
frame:SetScript('OnUpdate', function()
var = "var"
foo = "foo"
crap = "crap"
	if dostuff then
		dostuff
	end
end)
It's what i did when i had performance issues and it helped loads, this is obviously not a working function and you would have to tweak it to your liking.
I'm nowhere near the others in terms of knowledge of LUA though, so this might not be the optimal solution.

EDIT: This also solves the issue where a global foo is not found.
__________________
All I see is strobe lights blinding me in my hindsight.
 
04-18-09, 01:27 AM   #29
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by yssaril View Post
why not declare your upvalues outside of the OnUpdate so that you don't have to mess with the locals inside of it

Code:
local frame=CreateFrame("Frame")
local foo,bar,text
frame:SetScript("OnUpdate",function(self)
	if not foo then 
		foo,bar,text="foo","bar",""
	end
	text=foo..bar
end)
this way you dont mess with globals and you retain the info between onupdates

also 60 upvalues is a tonne can you post your code and maybe we can find a better solution all together?
Because for some reason (or maybe no reason at all?) WoW's addon parser falls over and dies if there are over 60, and I can't find any way around this.

I need over 60 because I have over 60 variable values that are used. Some of them only vary between nil or 1, but I can't find any practical (not horribly slow) way to do bitwise operations so they need to each have a variable.


Originally Posted by Wimpface View Post
What about creating the variables outside the OnUpdate function and then change the values?

As such:
Code:
local var
local foo
local crap
frame:SetScript('OnUpdate', function()
var = "var"
foo = "foo"
crap = "crap"
	if dostuff then
		dostuff
	end
end)
It's what i did when i had performance issues and it helped loads, this is obviously not a working function and you would have to tweak it to your liking.
I'm nowhere near the others in terms of knowledge of LUA though, so this might not be the optimal solution.

EDIT: This also solves the issue where a global foo is not found.
That's what I tried to do, and wasn't able to, and thus why I made this topic. WoW has a seizure when there are over 60 of those variables.
 
04-18-09, 01:37 AM   #30
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Azul View Post
That's what I tried to do, and wasn't able to, and thus why I made this topic. WoW has a seizure when there are over 60 of those variables.
Aha sorry, i misunderstood the thread.
Never mind me!
__________________
All I see is strobe lights blinding me in my hindsight.
 
04-18-09, 01:39 AM   #31
Pytlask
A Defias Bandit
 
Pytlask's Avatar
Join Date: Apr 2009
Posts: 2
Originally Posted by Azul View Post
I'm really starting to hate lua with a passion. To bad there are no alternatives.
What programming languages have you used previously? We may be able to provide parallels to make this easier for you to understand.

As far as I know though, all of the popular ones use a similar scoping mechanism to Lua. The primary difference is that most languages default to local scoping while Lua defaults to global scoping.

The following are essentially equivalent:

Lua:
Code:
do
	local varName = 1;
end
C/C++:
Code:
do {
	int varName = 1;
}
Python:
Code:
def aFunc ():
	varName = 1
It seems to me that you are confusing the Lua "local" keyword with the C/C++ "static" keyword.

Edit: If you need 60 local variables, you are doing something wrong. Is there a reason you can't just show us the code you have right now so that we might suggest a better method?
 
04-18-09, 01:42 AM   #32
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
idk then without looking at actual code there is not much we can help other to say that you cant have more than 60 (i believe it has something to do with how local are stored memory wise in lua same thing that also makes them fast)

also may i ask what are you Checking OnUpdate that requires more than 60 values just sounds inefficient to me to start with
 
04-18-09, 01:47 AM   #33
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by Pytlask View Post
What programming languages have you used previously? We may be able to provide parallels to make this easier for you to understand.

As far as I know though, all of the popular ones use a similar scoping mechanism to Lua. The primary difference is that most languages default to local scoping while Lua defaults to global scoping.

The following are essentially equivalent:

Lua:
Code:
do
	local varName = 1;
end
C/C++:
Code:
do {
	int varName = 1;
}
Python:
Code:
def aFunc ():
	varName = 1
It seems to me that you are confusing the Lua "local" keyword with the C/C++ "static" keyword.

Edit: If you need 60 local variables, you are doing something wrong. Is there a reason you can't just show us the code you have right now so that we might suggest a better method?
I've never encountered any scripting or programming languages that have a 60 variable limit. This is the first time.



There's really nothing interesting to see in my code. I just have a lot of variables. Some of them could be condensed by an efficient bitmasking operation, but it seems Lua only has extremely slow function based ones.

Originally Posted by yssaril View Post
idk then without looking at actual code there is not much we can help other to say that you cant have more than 60 (i believe it has something to do with how local are stored memory wise in lua same thing that also makes them fast)

also may i ask what are you Checking OnUpdate that requires more than 60 values just sounds inefficient to me to start with
What do you hope to see? And why? It's completely irrelevant to the question at hand. All I'm asking for a way to have >60 local variables. I'm not sure what more information is needed then that.
If you think there's some easy way to "fix" my code to not need this many values.. trust me, there isn't.

Last edited by Azul : 04-18-09 at 01:50 AM.
 
04-18-09, 01:52 AM   #34
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
imo any code that generates errors is interesting
also unless we see it i don't think we can help anymore since there is no way to have more than 60 locals per block

and lua has the issue because in the end its not a programming language its a scripting language so it has much tighter limitations than any full blown programming language
 
04-18-09, 01:56 AM   #35
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by yssaril View Post
imo any code that generates errors is interesting
also unless we see it i don't think we can help anymore since there is no way to have more than 60 locals per block

and lua has the issue because in the end its not a programming language its a scripting language so it has much tighter limitations than any full blown programming language
PHP, Python, Lisp, Perl, etc are also scripting languages.
And stop asking for my code already, please. There's nothing relevant in it other then the fact it has over 60 variables, which you already know. It's super ugly and uncommented right now.
 
04-18-09, 01:57 AM   #36
Pytlask
A Defias Bandit
 
Pytlask's Avatar
Join Date: Apr 2009
Posts: 2
Originally Posted by Azul View Post
There are no scripting or programming languages that have a 60 local variable limit besides Lua.
No, not a specific 60 local variable limit, but they do usually have limits. With several functions using 60 variables, you can easily pass the maximum stack size in C. (Yes, some would likely have to be arrays/strings)

Originally Posted by Azul View Post
There's really nothing interesting to see in my code. I just have a lot of variables. Some of them could be condensed by an efficient bitmasking operation, but it seems Lua only has extremely slow function based ones.
Actually, Lua's implementation of the operations in the bit library are extremely efficient.


Originally Posted by Azul View Post
What do you hope to see? And why? It's completely irrelevant to the question at hand. All I'm asking for a way to have >60 local variables. I'm not sure what more information is needed then that.
We hope to see the code, because that is where the problem is. You do not need 60 local variables in an OnUpdate function. If we can help you separate out the different operations into separate OnEvent functions, you will not have to worry about the 'inefficiency' of using tables to store options. (Lua tables are actually very efficient as well. You just have to be careful about leaving them around as garbage)
 
04-18-09, 02:00 AM   #37
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
Originally Posted by Azul View Post
PHP, Python, Lisp, Perl, etc are also scripting languages.
And stop asking for my code already, please. There's nothing relevant in it other then the fact it has over 60 variables, which you already know. It's super ugly and uncommented right now.
in that case i dont know what else to say other than you need to find a different approach to your problem since the limit wont go away
 
04-18-09, 02:01 AM   #38
Azul
Banned
 
Azul's Avatar
Join Date: Apr 2009
Posts: 19
Originally Posted by Pytlask View Post
No, not a specific 60 local variable limit, but they do usually have limits. With several functions using 60 variables, you can easily pass the maximum stack size in C .
Not limits anywhere near this low. And it's just one function, not several. And I've seen several addons give C stack overflow errors, and they didn't even use local variables at all!



Originally Posted by Pytlask View Post
Actually, Lua's implementation of the operations in the bit library are extremely efficient.
It being functions alone makes it outrageously more slow then it should be. Bitwise operations are supposed to be single opcodes, not dozens of branches and multiplications.




Originally Posted by Pytlask View Post
We hope to see the code, because that is where the problem is. You do not need 60 local variables in an OnUpdate function. If we can help you separate out the different operations into separate OnEvent functions, you will not have to worry about the 'inefficiency' of using tables to store options. (Lua tables are actually very efficient as well. You just have to be careful about leaving them around as garbage)
I don't see how having two OnUpdate functions with 30 variables each would be faster then a single OnUpdate function with 60. If anything it should be a lot slower.
 
04-18-09, 02:04 AM   #39
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
We don't really care if it's "super ugly" and "uncommented", we'll be able to tell you how to approach this problem from a different angle if there is one anyway.

The easiest solution would be to post the code, and stop being arrogant. It's going to come back and bite you in the butt!

It's your choice, but you are asking for help. People are trying to help you. In order to help you they need your code as that's where the problem is.
Take it or leave it, people will get tired of helping you when you won't help them to help you.

Lots of helping in there, and it may sound like a rant but it's not.
__________________
All I see is strobe lights blinding me in my hindsight.
 
04-18-09, 02:08 AM   #40
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
Originally Posted by Azul View Post
I don't see how having two OnUpdate functions with 30 variables each would be faster then a single OnUpdate function with 60. If anything it should be a lot slower.
he dosnt mean another OnUpdate function but OnEvent functions

are any of your variables you are constantly checking for related to any of the in game events? http://www.wowwiki.com/Events_(API) (this is why people want to see your code to help you optimize it and we dont care how it looks)

since using an event handler is usalualy alot more efficient than an OnUpdate handler (which you should usually try to avoid)
 

WoWInterface » Developer Discussions » Lua/XML Help » function "has more then 60 upvalues"

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off