wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > - Submit a resource -
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-05-2010, 10:34 AM   #1
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default [tool] JassOptimizer

Hell o, am back

thanks to conscription and the stupid bundeswehr-fuckers i had to make an involuntary pause in my mapping activities...

onTopic:
today i checked some of my maps and found lots of unperformant code, so i decided to write an optimizer for it and viola here it is.


requires microsoft .Net framework 3.5 or higher

usage:

quite simple
- get the executeable
- extract the "war3map.j" from your map or use another .j file
- execute it
- drop your beloved piece of code (.j-file)
- press enter
- wait some sec
- go to the displayed output-path and use the file with "_optimized.j"
- check the code again (if you don't trust me)
- name it "war3map.j" and place it in your map again

ATTENTION:
PLEASE FOR THE SAKE OF THE OLD GODS USE ONLY FILES W I T H O U T SYNTAX-ERRORS, otherwise the program will bug or crash

optimization-details:


- constant inlining
- removes unused globals
- removes unused functions (never call functions via ExecuteFunc(someFancyNonConstantVariable))
- removes stupid functions (like DoNothing or without code and no function-call in local-declaration)



if you wanna have the source, pm me...

changelog:


1.0.0.0: initial release



to do:


- find some way to reduce framework number (without causing random crashes)
- make the desobjusificator work
- add function inliner
- add some kind of syntax-check
- find a way to add it into jngp
- add detection of unreachable code (if false then, exitwhen true)
- add detection of critical errors(endless loops, ExecuteFunc + nonexistant function name, ...)
- precalculate constants

Attachment 49638
Attached Files
File Type: zip jo.zip (156.2 KB, 37 views)
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr

Last edited by Tot : 10-05-2010 at 06:18 PM.
Tot is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-05-2010, 01:13 PM   #2
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

post any code before and after optimization.

i suggest you to optimize code of any custom blizzard map, skibi for exs
DioD is offline   Reply With Quote
Old 10-05-2010, 01:57 PM   #3
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

attached files in first post...
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 10-05-2010, 04:45 PM   #4
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

your system mess with spaces, easy to detect on jasshelper__initstructs25167235

also constant inline failed for functions and basic mathematic operations.
DioD is offline   Reply With Quote
Old 10-05-2010, 06:17 PM   #5
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

Quote:
Originally Posted by DioD
your system mess with spaces, easy to detect on jasshelper__initstructs25167235

can't follow you...plz explain further

Quote:
Originally Posted by DioD
also constant inline failed for functions and basic mathematic operations.

ähm yea, maybe i should mention that it does atm only inline constant GLOBALS with containing no function calls or other operations, cause in some cases the code would become slower when inlining these...
ex
Collapse JASS:
globals
constant real HardToCalc = SquareRoot(Cos(12)*Sin(32)*Atan(45)+I2R(R2I(Pow(Cos(18+Tan(8)),Atan2(6,13)))))

function Test takes real f returns nothing
local integer i=0
loop
exitwhen i>HardToCalc*f
set i=i+Atan2(HardToCalc,HardToCalc+1)
endloop
endfunction

i know it's a constructed and exaggerated example, but something like this can happen...therefore I'm searching a way to precalculate such constants...buggy atm
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 10-06-2010, 04:02 PM   #6
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

its possible to calculate this inside optimizer (just include some limits, 2-3 levels of variables) and pass actual data into inline.
DioD is offline   Reply With Quote
Old 10-07-2010, 08:42 AM   #7
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

Quote:
Originally Posted by DioD
its possible to calculate this inside optimizer (just include some limits, 2-3 levels of variables) and pass actual data into inline.

i know, that's what i'm trying to add in the next version...ufo it currently bugs heavyly or miscalculates (2+3*4 = 20 )

what's with the space-mess?
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 10-07-2010, 10:39 AM   #8
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

your optimizer add spaces, i posted function name, check before and after.

to calculate properly you shoud sort actions by priority levels or hook into some other math library.
DioD is offline   Reply With Quote
Old 10-07-2010, 11:35 AM   #9
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

Quote:
Originally Posted by DioD
your optimizer add spaces, i posted function name, check before and after.

yea...and where's the problem/bug?
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 10-08-2010, 03:40 AM   #10
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

this is dead data, it shoud remove useless spaces not add em.
DioD is offline   Reply With Quote
Old 10-08-2010, 05:54 AM   #11
Tot
†6†
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

Quote:
Originally Posted by DioD
this is dead data, it shoud remove useless spaces not add em.
you're right
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 10-10-2010, 06:39 PM   #12
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

No offence and all, but does it more than wc3mapoptimizer ?
I suppose so, but could you detail the differences ?
__________________
Cool != Useful
Troll-Brain is offline   Reply With Quote
Old 12-12-2010, 05:24 PM   #13
SanKakU
User
 
Join Date: Jan 2009
Posts: 136

SanKakU has a little shameless behaviour in the past (-2)

Send a message via AIM to SanKakU Send a message via MSN to SanKakU Send a message via Yahoo to SanKakU
Default

lol...when i want to remove empty spaces i do ctrl h and enter 4 spaces in top line, nothing in bottom line and hit all and bam, code optimized...well, at least primed for optimization. if your code adds those 4 spaces back everytime it's run...then it's trash.

Last edited by SanKakU : 12-12-2010 at 05:24 PM.
SanKakU is offline   Reply With Quote
Old 03-02-2011, 10:17 AM   #14
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

Having spaces in your code does nothing at all in performance nor KB size.
Bribe is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT. The time now is 04:14 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services