| 05-09-2007, 10:35 PM | #1 |
I have decided to check how slower globals would be if i would have a FUCKING A LOT of it in my map (or common.j or blizzard.j) . i don't know how many global and alot of inited vars i have but the blizzard.j (is totaly obfuscadet so NO function are inside ONLY vars !) and the blizzard.j size is 500 kB =) i think its alot of vars... and what the of this thread !? to say what jass (war3) ignors how many globals you got you will ever get the same performance !!! if to be true i was a bit shocked and happy (cause i like global vars) ! yes the local vars a bit faster than globals but locals need to be inited (it takes some time to ;) well and it's slower than Sin,Cos...) ok here the test map ! DON'T SAVE IT IN WE !!! cause it a "hand work" =) it was optimized to work with out any bj shit and any common.j vars so it needs only common.j natives. and if you will check the performance only with 2 !!! globals vars so delete anything in blizzard.j (don't delete globals endglobals ... but who knows =) maybe it can be deleted too.) and save and replace it. so you would get only 2 globals in your map ! (common.j is also cleaned... but includes some custom funcs ;) ) to run this map you need JAPI tool or (JassNewGen Pack and run war3 using startwar3.bat and enabled JAPI injection ) in game you must press "Esc" to launch the test... // also you can test local var speed ;) // the results are relative theoreticaly it's needed time in msecs. but it's not correct so you need only compare the values ! |
| 05-09-2007, 10:40 PM | #2 |
ive already tested it, globals isnt very slow, but it surely is slower than locals. When test with my system, on around 500 objects moving, by using global vars it was 5-8 fps slower than locals. So that isnt big different, but some... But thanks for info :) |
| 05-09-2007, 10:46 PM | #3 |
MaD[Lion] no =) it's not the point ! i know what difference ist minimal i mean you can have 10K of vars and arrays and it changes almost nothing ! and btw the loading time is the same if not so max a 0.5 difference ! i you would got 10K vars =) to create a 10 lvl ability and add it to you whan loading will slow it so =) so DON'T CARE CREATE SO MANY VARS HOW YOU WANT ! it will change only your xxx.j file size ;) ! |
| 05-10-2007, 07:53 AM | #4 |
file size makes 56k'ers download slower... |
| 05-10-2007, 12:10 PM | #5 |
I once had the idea that it would be better to use only global vars in my engine in order to avoid repeatedly initializing locals. The result is that the whole engine ran about 20% slower. According to Pipedream the speed of variable access depends on how many other vars there are in that scope. vJASS maps can create thousands of global vars for structs, so globals have a very long list to sort through, whereas locals typically only have a few. So basically, whichever you have fewer of (locals or globals) should be faster, but you will always have more globals than locals unless you are a freak. |
| 05-10-2007, 03:04 PM | #6 | ||
Quote:
in this test map i got min 10K of random vars and arrays ! and it does not slow something down ! the speed is as i would got only 2 GLOBAL VARS AT ALL ! (for this i have specialy cleared common.j and blizzard.j). Quote:
if you are so clever-asses so simple take a look at the map which is attached ! |
