Quick Speed Fact

Troll-Brain

You can change this now in User CP.
Reaction score
85
But in a real world scenario, arrays variables would be slower than not array ones, since most of the time you use a variable for the index, and not a constant.

Btw you haven't said the difference local array VS local not array.
 

Nestharus

o-o
Reaction score
84
Quote:
Originally Posted by Nexor View Post
"local arrays are faster than local variables"'

check again, it's there without %
That's exactly what i want to know the "%" ...

Wasn't up there because my computer frozen while I was getting the percents and updating the scripts on this post to show percents : |.

I'm so tired of Vista... with its random freezes because of the TERRIBLE WMI on vista...

Oh well, I can get the percent up I suppose.

Edit
It's now up at 7.5% faster
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Let's add the most interesting (not that it would matter that much but it's clearly the least useless one) local VS global
 

Nestharus

o-o
Reaction score
84
I can do the math for you if you like, no need for a test on that, lol...

If global arrays are anywhere from 10% slower to 10% faster than a global variable... and global arrays are 35% faster than local variables..

then it would stand that global variables are 35% faster than local variables o_O.

Sry, typo in my guide fixing now. 25% should be 35% o-o.

Also I fixed a couple of other values. I was winging the values from the tests before my comp froze because I was too upset to test again. Retested the values I wasn't sure about when I winged them.

Did you know GetLocalPlayer() is the same speed as Player()? According to the tests, wrappers are both 33% faster than those. GetLocalPlayer() is the same speed as a Convert function O_O.
 

Azlier

Old World Ghost
Reaction score
461
Did you test a global array vs. [lJASS]Player[/lJASS]? If the array's faster, GetPlayer wins.
 

Jesus4Lyf

Good Idea™
Reaction score
397
>I was winging the values
Then don't state them as fact. Maintain credibility, it makes it easier for all of us.

>then it would stand that global variables are 35% faster than local variables o_O.
Hence why I use globals instead of locals. Significant difference. HOWEVER, I am not convinced that this is reliable. You are performing useless tests (for public use) if you do not complete one test with % benchmarks for each of the following situations.
  • Setting a local variable vs setting a global variable with a precondition: 100 locals declared and 1 global.
  • Setting a local variable vs setting a global variable with a precondition: 1 locals declared and 100 globals.
  • Getting from a local variable vs getting from a global variable with a precondition: 100 locals declared and 1 global.
  • Getting from a local variable vs getting from a global variable with a precondition: 1 locals declared and 100 globals.
  • The execution time of declaring a local variable compared to setting a global variable with a precondition: 100 locals declared and 1 global.
  • The execution time of declaring a local variable compared to setting a global variable with a precondition: 1 locals declared and 100 global.
Then I'll take you seriously and not brush you off as thinking a single test proves something. Document it thoroughly, and I won't accept cJass benchmarks because I do not know what code cJass compiles to in the background. I don't care to assume.

>According to the tests, wrappers are both 33% faster than those.
You do not seem to know what a "wrapper" is. A wrapper wraps another function, which means it cannot be faster than the original function. Choose a better term and define what you mean by it. I have no idea what you mean, so far.
 

Nestharus

o-o
Reaction score
84
>I was winging the values
Then don't state them as fact. Maintain credibility, it makes it easier for all of us.
arrays that point to a value from a convert native are faster than using the convert native ^_-

Document it thoroughly, and I won't accept cJass benchmarks because I do not know what code cJass compiles to in the background. I don't care to assume.

I don't write vJASS anymore ^_^, and I do know what cJASS compiles to : o. If you don't want the benchmarks, I'll remove them. If you do, they're going to be in cJASS : ). IF you want vJASS resources, you are totally free to write vJASS versions ^_^. All the code is there, so you could just cnp and rewrite it all for vJASS syntax = ). I'm not going to =).

I finally decided that I'd help out the community in my own way =). When it comes to given resources that are going to be in maps, they will be in the required standards. When it comes to answering questions or writing tutorials, they will be in standards that I deem to be the best practice =), but I will also include writing on more standard practice and syntax, for example the JASS guide I've been writing. It introduces with cJASS, but it goes over JASS syntax.

This thread is a list of facts, meaning the purpose here is to list out facts and show the differences. The benchmark code is given if you really want to try it out for yourself, but the benchmarking part is an extra. There are plenty of sites that include benchmark results on questions but no code. Because it is an extra, it is in a medium of my choosing.

Then don't state them as fact. Maintain credibility, it makes it easier for all of us.

Also I fixed a couple of other values. I was winging the values from the tests before my comp froze because I was too upset to test again. Retested the values I wasn't sure about when I winged them.

Meaning I didn't in fact go, hey I think this is this speed and that speed .... I just didn't want to retest everything that I had just tested =p

* Setting a local variable vs setting a global variable with a precondition: 100 locals declared and 1 global.
* Setting a local variable vs setting a global variable with a precondition: 1 locals declared and 100 globals.
* Getting from a local variable vs getting from a global variable with a precondition: 100 locals declared and 1 global.
* Getting from a local variable vs getting from a global variable with a precondition: 1 locals declared and 100 globals.
* The execution time of declaring a local variable compared to setting a global variable with a precondition: 100 locals declared and 1 global.
* The execution time of declaring a local variable compared to setting a global variable with a precondition: 1 locals declared and 100 global.

Eep, lots of tests, but I'll do them o-o.
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Eep, lots of tests, but I'll do them o-o.

It's because you say things like
>This thread is a list of facts
without realising that the speed of JASS stuff varies with all kinds of factors. :p

Makes you say things like
>arrays that point to a value from a convert native are faster than using the convert native
after Azlier and Renendaru already tested [LJASS]Player[/LJASS] against an array and found that which is faster depends largely on the amount of stuff existing in the map. Wouldn't be too surprised if the "convert" natives were much the same.

I wish everyone would stop assuming that JASS is linear, or makes sense. This whole thread is a mistake, in that regard.
 

Nestharus

o-o
Reaction score
84
This thread was put up because a thread like this was needed. If the thread goes about it the wrong way, then fix it. If you care about it so much, then help with the thread ...

Everything I post I post to help the Warcraft 3 community... do you think I put this stuff up for fame or glory? Why the hell would I be writing a guide or quick speed facts... I'm doing it because it's in my nature to help other people, and it's in my nature to try and make things better.

You submit some fantastic things Jesus4Lyf, and I think you submit them because you want to help out the community overall as well. You couldn't help on wc3c.net because they rejected your resource for no reason at all, even though it was better than what they had, so you came here.

I keep trying to push people to make things together... I keep trying to push communities together to produce fantastic resources. There's a wiki from you guys, but not many people are involved. Heck, a lot of people don't even know it exists o-o.

Do you want to know what I've learned?
1. There is no good JASS guide right now... they get too technical, they do this, or they do that... and the author isn't generally open to criticism, or people just don't bother with it.

2. There is no list of things like this... what if someone wanted to know what the best way to do something was? Is everyone supposed to test it on their own?

How many people knew that filterfuncs and boolexprs were the same speed in enumerations? Whenever I used an enumeration, I was always wondering which one was better. There's nothing written on this stuff.

What about the hashtable speed? People said, hey yea, it's like 1.7x faster according to some of these tests. Do I have that for granted? No, it was said on one post as a sidenote in one thread and pretty much sort of became a rumor. Could it be true? Yea. Could it be false? Yea. No way to know for certain.

Next, there are tons of things that are just plain wrong. TheHelper used to be like that, but it's a lot better now. When I first came to TheHelper, it was at the point where most people had it in their mind that you couldn't use 0 as an index in an array. Why? The official guide told them so.

When I see something is missing or something is wrong, I try to fix it.

Look at The Hive Workshop. They approve a tool and then they say you're not allowed to use it. Their response was, personal use only. Why did it even need to be approved then? This is cJASS btw, but they compared it to an MPQ Tool. cJASS is used to write resources. The MPQ tool is not. What a terrible load of bull. No reason why cJASS shouldn't be allowed at all in my opinion, 0 reason. It writes code that you'd have to write out yourself anyways, and it's going to be doing things that Vexorian said he'd never ever do, like method overloading. Some of the stuff Vexorian says just piss me off ; |.


I'm making an effort to try and help. I see all of these things wrong and I'm trying to fix them. I also continue to try and improve myself and my methods of doing things. If you notice, whenever you say something is wrong here are there, I make an immediate effort to fix it.

I'm also trying to get people more into-
Minimize Coupling
Maximize Cohesion

Hence Recycle. People are like, So much stuff that does that already. I'm saying that the stuff that does it already is wrong. Why? It couples a resource you don't necessarily need with a resource that you do need.

There's just so much... when writing out stuff, I can't even do plain structs anymore... the code vJASS generates is just so horrible... I let Vexorian know. Turns out he's not going to fix it. Why? He didn't say. Hurray for us.



Yea, I guess I just kind of exploded, but there's just so much crap that's been getting to me and well, yea, it's all out in the open now.

I think that it's wrong to not approve of cJASS and to not allow cJASS resources.

I think it's wrong to graveyard a resource that does something and does it well just because you don't deem it useful.

I think it's wrong to require authors to show examples of why their resource is useful. People can use these resources for whatever they want.

I think it's wrong for someone to submit a resource and then have someone else point out a flaw for it and have the author say: don't really care. If someone asks you about a feature, or someone asks you about something, or someone finds a flaw and you know it's a flaw, then something is wrong. You need to fix it or you just need to say: graveyard this then, not motivated enough to do it.

I'll continue to try and help other people out as best I can and I'll continue to try and fix all of these problems... but am I alone here? Am I the only one who sees all of this stuff? Do people just not care?
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Next, there are tons of things that are just plain wrong. TheHelper used to be like that, but it's a lot better now. When I first came to TheHelper, it was at the point where most people had it in their mind that you couldn't use 0 as an index in an array. Why? The official guide told them so.

I don't let falacies get past me, which is why I told you to go do those extra tests and denied that a single benchmark makes them facts.

>Hence Recycle. People are like, So much stuff that does that already. I'm saying that the stuff that does it already is wrong. Why? It couples a resource you don't necessarily need with a resource that you do need.

"It couples a resource you don't necessarily need with a resource that you do need" is why I didn't let you use cJASS to modify it. It is also the hesitance towards accepting cJass.

>I think that it's wrong to not approve of cJASS and to not allow cJASS resources.
If things are done correctly they will succeed. Patience is a virtue. Stop pushing cJass so hard, we know it's there and we'll get to it.

And in regards to everything else you said, I say think of the bloat. Approving all resources would lead to a resource section more bloated than Vexorian's structs (to drive your own point home to you).

Edit:
Back on topic. Let us know how those tests go. :)
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
How many people knew that filterfuncs and boolexprs were the same speed in enumerations? Whenever I used an enumeration, I was always wondering which one was better. There's nothing written on this stuff.
Interesting. I personally never wondered, mainly because of this line:
common.j said:
[ljass]type filterfunc extends boolexpr[/ljass]
I always just figured they would behave the same, which is a little unscientific, but eh.

Look at The Hive Workshop. They approve a tool and then they say you're not allowed to use it. Their response was, personal use only. Why did it even need to be approved then? This is cJASS btw, but they compared it to an MPQ Tool. cJASS is used to write resources. The MPQ tool is not. What a terrible load of bull. No reason why cJASS shouldn't be allowed at all in my opinion, 0 reason.
It's beta and not a community standard.

Hence Recycle. People are like, So much stuff that does that already. I'm saying that the stuff that does it already is wrong. Why? It couples a resource you don't necessarily need with a resource that you do need.
Most of the time, the other resource is useful. Not all TypeUtils stuff is attachment, and when it is, it's usually a good attachment system (TU Red).
Take SoundUtils. It's a recycler at heart, but it does STUFF.

It would be neat to have a general recycler, except that it usually IS practical to have add-ons with Jass types.

And most people seem to prefer function syntax.

when writing out stuff, I can't even do plain structs anymore... the code vJASS generates is just so horrible... I let Vexorian know. Turns out he's not going to fix it. Why? He didn't say. Hurray for us.
He's not going to fix it because it doesn't need fixing. It is a tad messy, but it works fine without any real performance issues. In any case, using it where applicable is usually far preferable to making your own stuff in cJass and slapchopping it about.

Yea, I guess I just kind of exploded, but there's just so much crap that's been getting to me and well, yea, it's all out in the open now.
You're acting like other people aren't aware of it. They are. they just don't care, because it's a negligible problem, it will never stand in your way, and working around it is far more tedious in any case than just living with it.

I think that it's wrong to not approve of cJASS and to not allow cJASS resources.
cJass isn't a community standard, and is still beta.

I think it's wrong to graveyard a resource that does something and does it well just because you don't deem it useful.
Obviously if they don't deem it useful, they don't think it does something useful well. Thus you've attributed two arguably mutually exclusive attributes to the same object.

Your contradictory statement implies that you have an issue with the system that this site uses for approval. If perceived usefulness by the community and moderators isn't a functional standard, what should be?

I think it's wrong to require authors to show examples of why their resource is useful. People can use these resources for whatever they want.
If nobody can understand what the point of a resource even is, there's no point approving it.

Do people just not care?
Probably.

edit: Back on topic:
Benchmarks are fun! :)
 

ZakkWylde-

New Member
Reaction score
14
...
I can also only postulate as to why the globals are pretty much same speed (-10% to 10% cancels).
...

Alas, coming after VERY VERY LONG and undoubtedly relevant posts, I had to be finicky and not overlook this (on an irrelevant note).

-10%, [90/100] does not "cancel out" +10%, [110/100].

Multiply the two and you get 9900/10000. 99% AHHAAA!! WE CAN NOW CONCLUDE THAT...most likely...GLOBAL VARIABLES are "on average" slower than GLOBAL ARRAYS (by 1%...if you can measure it like that...)

I love a good conclusion.
 

Jesus4Lyf

Good Idea™
Reaction score
397
If FunctionB's speed is randomly FunctionA's speed +/- 10%, that means it is always within 10% of the speed of FunctionA (which is what Nestharus stated).

Therefore, it is between 90% and 110% the speed of FunctionA (what Nestharus is saying).

The average of 90% and 110% is 100%. The same speed. It is not taking the speed of FunctionA and adding 10% and then REMOVING 10%, it is doing one or the other, separately. Consider what he is measuring. :)
 

ZakkWylde-

New Member
Reaction score
14
Was I hallucinating or were two posts here....before yours (J4L) and after mine...? and then when I tried to quote something I said in that post to put it here...it gave me an INVALID LINK error...and then I went back to this page and the two posts were gone...!!


One by a guy with a polar bear icon =D and one by me...

anyways...

something in my mind is telling me that this isn't a case where taking the average of the low bound and the high bound gives you the "actual average" (that is, it's useful-factor, if you will).

baaaahhhh...too tired to explain why my mind is deceiving me...(if it is deceiving).
 

Nestharus

o-o
Reaction score
84
Ok....

Edit
Benchmarks up


If you were to do something 100 times

50 times you got 20

50 times you get 30

The average would be 25... or am I wrong?
something in my mind is telling me that this isn't a case where taking the average of the low bound and the high bound gives you the "actual average" (that is, it's useful-factor, if you will).

And if you mean usefulness of knowing the average, do you mean you would rather know the high bound and low bound?

I fail to see how knowing the high bound and low bound would help ^_^.

If the low bound is something like 68.111592895932% and the high bound is like 82.39583202359320%

82 + 68 = 75%

That's actually for arrays vs hashtables (I just typed randomness for decimals, lol).

68% and 82%

Now tell me how that information is going to help you?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
The filterfunc variable and boolexpr variable are the exact same speed! They also both retrieve the Filtered Unit at the same rate : D. It doesn't matter which one you use.
I use conditionfunc in enuming groups. o.o
 

Jesus4Lyf

Good Idea™
Reaction score
397
Fantastic new benchmarks - would be nice to have the code in spoilers.

Really shows that the speed is unreliable, but is consistently in favor of globals.

Really need to code to be sure about what you mean - and I don't know that your news item is that important... :p

The comparison between "local integer i" and "set I = 5" is purely for reference of when it is worth using a local instead of a global, in the case that globals are slower... but basically globals are all round faster, apparently. :)

I'd not be surprised if there's situations under which locals are faster. I wonder if the speed varies with any other factors... ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top