Code Speed: Functions

NoobImbaPro

You can change this now in User CP.
Reaction score
60
They have same speed or second is faster?

JASS:
.
    function A takes nothing returns nothing
        //a bunch of lines
    endfunction

    function B takes nothing returns nothing
        if condition then
            call A()
        endif
    endfunction


JASS:
.
    function B takes nothing returns nothing
        if condition then
            //lines of function A
        endif
    endfunction
 
This is (usually) even better, though:
JASS:
function B takes nothing returns nothing
    if not condition then
        return
    endif
    // lines of function A
endfunction

This way you can skip the rest of the function (like searching for the [ljass]endif[/ljass].)
 
Only if function A was only one line of code. Otherwise it wouldn't (couldn't).
 
Functions without parameters cost nearly nothing. Else it has to declare the locals and assign them the incoming values. But it's nuts to make this priority. There are other interests mapmakers strive for like progress, modularity, not write the same things twice, build greater structures. Would only do this if it was really necessary in the standalone low-level.
 
I use functions to avoid duplicate text whenever possible. I also recommend to anyone else to do the same.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The federal government should do the military not the police. I hope Trump gets rid of the income tax
  • The Helper The Helper:
    I hold no hope of Trump getting rid of income tax though.
  • jonas jonas:
    Trump is a wildcard, but in the end, it's the republican party that makes the laws, Trump can only do exec orders
  • jonas jonas:
    I don't think the Republicans will get rid of income tax, at most lower it a little, mostly for people with 6 figures+. But that's just my opinion
  • The Helper The Helper:
    one can dream
  • Ghan Ghan:
    FairTax would be nice.
  • Ghan Ghan:
    But the electorate would have to demand it and vote people in to do it.
  • Ghan Ghan:
    Government spending, foreign policy, and the southern border are all bigger issues than the income tax right now I'd say.
  • The Helper The Helper:
    For you those are the bigger issues. Cannabis legalization and get rid of Income tax are mine.
  • Ghan Ghan:
    We have so much cannabis up here in Oklahoma. Can't go a block without running into 3 dispensaries. xD
  • The Helper The Helper:
    if the demand is there
  • jonas jonas:
    I think the biggest issue in USA is how divided the country has become
  • Ghan Ghan:
    There's a big split happening in fundamental values that is very worrisome.
  • jonas jonas:
    I think there's always been a split in values. But now there's a split in what reality is. No matter whom you ask, they think a third of the country is insane and wants to destroy the country
  • The Helper The Helper:
    pretty big split
  • The Helper The Helper:
    Happy Saturday!
    +1
  • V-SNES V-SNES:
    Happy Saturday!
    +1
  • The Helper The Helper:
    Dont forget to check out the list of all the recipes on the site at the Recipe Index - I am about to take Ghan up on the offer of making that a site :) https://www.thehelper.net/threads/main-recipes-menu-recipes-index-version-2-0.189517/
  • The Helper The Helper:
    We should add that as part of site navigation
  • Varine Varine:
    I just don't think Trump actually understands how the government works. I'm not going to pretend like I can understand the entirety of government but in my industry he kind of caused massive fucking issues. Tarriffs and the international counters had a pretty significant impact on what I do, it was actually kind of interesting to see though. I live in Idaho so I'm not really concerned with it, it'll be R pretty much the entire way down. We do have ranked choice on our ballot this year though and I DO really care about that. But if we are going to have a federal government we kind of need income tax. They could abolish it and tax states I guess, but then states are just going to raise income taxes. It's not really viable without a very significant and holistic overhaul of how the federal government works, and that isn't something I would expect Trump to do.
  • Varine Varine:
    I don't expect Harris to do it either. I want to see wealth and church taxes, but those also aren't things I'm going to hold my breath for.
  • jonas jonas:
    I mean he definitely doesn't, which is why he had to retract most of his executive orders, didn't manage to get rid of obamacare etc.
  • jonas jonas:
    B
  • jonas jonas:
    Replacing income tax with a wealth tax would be amazing imho, but I can't even imagine that this would happend
  • Ghan Ghan:
    Wealth tax would be a disaster. Imagine having to liquidate retirement accounts because you have a tax bill just for unrealized gains. Or your house goes up in price and you have to sell it to pay the tax bill.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top