Operation limit

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Well, I had some trouble the last weeks with the operation limit.

Though I solved the problems, I was wondering if someone could give me proper information about the operation limit itself:


1) How many operations are (on average) required to reach the operation limit?

2) What possible ways are there to create a new threat and thus resetting the operation limit? I know that you can use zero-timers, but are there other more elegant ways?

3) Is there a way to detect wether you are close to the op limit?

That's all for now. Thanks in advance.
 
2. The best way to avoid the op limit is by started a new thread via TriggerEvaluate or TriggerExecute.
 
1.The op limit is hard to calculate and not every action consumes equal amounts of it.
2. TriggerEvaluate, TriggerExecute or TriggerSleepAction. If you have a big loop you probably want to just add a sleep after some number of iterations.
3. No way to detect.
Actually here is my quick test suite.
JASS:
//! zinc
library test requires Table
{
    integer C0 = 0;
    integer C1 = 0;
    integer C2 = 0;
    integer C3 = 0;
    integer C4 = 0;
    integer C[];
    integer C10 = 0;
    integer C12 = 0;
    Table table;
    function test0()
    {
        while(true)
        {
            C0 +=1;
        }
    }
    
    function test1()
    {
        C1+=1;
        test1();
    }
    
    function test2(integer x)
    {
        C2+=1;
        test2(x);
    }
    function test3()->integer
    {
        C3+=1;
        return test3();
    }
    
    function test4(integer x)->integer
    {
        C4+=1;
        return test4(x);
    }
    
    function test5()
    {
        while(true)
        {
            C[0] +=1;
        }
    }
    
    function test6()
    {
        C[1]+=1;
        test6();
    }
    
    function test7(integer x)
    {
        C[2]+=1;
        test7(x);
    }
    function test8()->integer
    {
        C[3]+=1;
        return test8();
    }
    
    function test9(integer x)->integer
    {
        C[4]+=1;
        return test9(x);
    }
    
    function test10()
    {
        C10+=1;
        test10();
    }
    function test11()
    {
        table[0] +=1;
        test11();
    }
    
    function test12(integer x,integer y)
    {
        C12+=1;
        test12(x,y);
    }
    
    function onInit()
    {
        timer t = CreateTimer();
        timer t2 = CreateTimer();
        table = table.create();
        TimerStart(t,1,false,function()
        {
            BJDebugMsg("Globals");
            BJDebugMsg(I2S(C0));
            BJDebugMsg(I2S(C1));
            BJDebugMsg(I2S(C2));
            BJDebugMsg(I2S(C3));
            BJDebugMsg(I2S(C4));
            BJDebugMsg("arrays");
            BJDebugMsg(I2S(C[0]));
            BJDebugMsg(I2S(C[1]));
            BJDebugMsg(I2S(C[2]));
            BJDebugMsg(I2S(C[3]));
            BJDebugMsg(I2S(C[4]));
            BJDebugMsg("test10 "+I2S(C10));
            BJDebugMsg("test11 "+I2S(table[0]));
            BJDebugMsg("test12 "+I2S(C12));
        });
        test0.execute();
        test1.execute();
        test2.execute(0);
        test3.execute();
        test4.execute(0);
        test5.execute();
        test6.execute();
        test7.execute(0);
        test8.execute();
        test9.execute(0);
        TimerStart(t2,0,false,function test10);
        test11.execute();
        test12.execute(0,0);
    }
}

//! endzinc

Here are some quick thoughts:
1. Timer and trigger threads have the same number of ops.
2. Recursion gets more bang for your buck vs loop when you don't have parameters.

3. Array members consume much more op limit then non-array members. Hashtable consume even more.
4. Functions without parameters seem to preform the best, regardless of if they have a return.
5. The return statement seems to make no effect on op limit. This may because it never returns and thus never has to populate the stack.

Anyway the number is something like 33,333 global var reads in a loop or 45,000 global var reads in a recursive loop. Array reads are more get about 10,000 less on average. Inf recursion with a hashtable yielded a pathetic 15,000.

In theory if you want to be nuts you can just have a function that has 100,000 statements in it of all just a variable incrementing itself. It should crash and then one could figure out how many raw statements you can process in one function by using a similar approach. I think Cjass might be able to this.

The op limit can be kind of low, but as long as you don't try something crazy you should be safe.
 
Thanks for the detailed informations.
And yes, of course, the operation limit should - at least most of the time - not be a problem, but you can reach the op limit very fast with Map-Init functions, especially enumerations.

For example, in my rpg, I attach like 20-30 custom stats to all placed neutral hostile units on the map on map init, by just using global arrays with an indexing system. I was wondering why some mobs didn't have the custom stats, until I found out, that I exceeded op limit on map init.

I don't really understand why there is an operation limit to functions called on map init, as those functions are called during the map loading process anyways and thus can not create a "freeze", but well, that's blizzard logic.
 
I don't really understand why there is an operation limit to functions called on map init, as those functions are called during the map loading process anyways and thus can not create a "freeze", but well, that's blizzard logic.
Try doing [LJASS]call TriggerExecute(GetTriggeringTrigger())[/LJASS] on map init and say that again. :thup:
You can freeze the map with object editor data even - an orb effect which fires itself (causes infinite loop on load). XD
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
    +1
  • The Helper The Helper:
    It will only be on internal network
  • jonas jonas:
    Man the AI is good about gaslighting about security though. I've had several times where I pointed out security problems and it tried to convince me that with a tiny tweak it suddenly becomes secure
  • jonas jonas:
    Like using a distrobox as a "secure" container, and when I point out that's not secure at all, it claimed that specifying home will make it secure

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top