How Do I get the Executable Files Size down?
BlitzMax Forums/BlitzMax Beginners Area/How Do I get the Executable Files Size down?
| ||
here the code of Twister Demo as I have Compress it and it gone down to 615k......Surely should go down under 200k if possible with codes tweaking? On Blitzplus...The Executable Files size is 315k when been Compress where the BlitzMax is 615k! Const xRes = 800, yRes = 600 Const Pos1=175,Pos2=375 Global a#,x1#,x2#,x3#,x4#,ang#=0,amp#=7 HideMouse Type Twister Field X1#,X2#,X3#,X4# Function twister() For a=1 To 600 Step 2 x1=((Sin((a/amp)+ang))*100)+300 x2=((Sin((a/amp)+ang+90))*100)+300 x3=((Sin((a/amp)+ang+90*2))*100)+300 x4=((Sin((a/amp)+ang+90*3))*100)+300 SetColor 255,0,255 If x1<x2 DrawLine x1-Pos1,a,x2-Pos1,a;DrawLine x1+Pos2,a,x2+Pos2,a End If SetColor 0,0,255 If x2<x3 DrawLine x2-Pos1,a,x3-Pos1,a;DrawLine x2+Pos2,a,x3+Pos2,a End If SetColor 0,255,0 If x3<x4 DrawLine x3-Pos1,a,x4-Pos1,a;DrawLine x3+Pos2,a,x4+Pos2,a End If SetColor 255,255,0 If x4<x1 DrawLine x4-Pos1,a,x1-Pos1,a;DrawLine x4+Pos2,a,x1+Pos2,a End If Next ang=ang+2 If ang=360 Then ang=0 End Function End Type SetGraphicsDriver GLMax2DDriver() Graphics xRes,yRes,0 Global _Draw:Twister=New Twister Repeat _Draw.twister() Flip Cls Delay 20; Until KeyDown(KEY_ESCAPE) End Last edited 2011 Last edited 2011 Last edited 2011 |
| ||
try this: http://upx.sourceforge.net/ |
| ||
Yes, that what I have done and I guess you haven't read it properly when I say "here the code of Twister Demo as I have COMPRESS it and it gone down to 615k!" |
| ||
Try adding this at the top of the code. This will ensure the source code is compiled using ONLY the modules needed, rather than everythingFramework BRL.GLMax2D Import BRL.Math Import BRL.PolledInput |
| ||
Thanks Jim :) When I have Compress it and it gone down to 59k! Woot :) Here the Blitz Max Twister Demo Executable but not finished yet http://www.mediafire.com/?a0112yah69hhdjc Last edited 2011 |
| ||
Check out FrameWork Assistant http://homepage.ntlworld.com/config/fa/ It will help you figure out what modules you need to import. |
| ||
out of content: @Hotshot2005 you really need to work on those OOP skills or stay out of it. ;-). |
| ||
Hello Jesse :) It`s possible to make the Twister Code shorter than what I have done? Thanks TomToad as I know about that :) Last edited 2011 |
| ||
Also, be sure you do a Release build, and not a Debug build. A Debug build eats up quite some space as well. |
| ||
Well it got Quick Build Debuild Build(I do know it create huge File size!) Threaded Build(Not sure about this one as it seem to me that it like multi core threads) Build GUI App It doesnt have Release Build in there but if you talking about Quick Build as could that be it? I dont used Any of those when come releasing the Executable files :) |
| ||
not really smaller code but a bit more logical and OOP-ish. Fields do not play nicely with functions so while you declared the fields, they served no purpose. and please use strict or SuperStrict. Last edited 2011 releas mode is un-ticked debug mode. Last edited 2011 |
| ||
'Release Build' is the opposite of 'Debug Build' -- in debug build there is a lot of additional information tracked that can help troubleshoot problems with program execution, at a penalty of much slower speed and larger file size. Disabling debug build means you're doing a release build. Threaded Build allows a program to add multi-threading commands to take advantage of multiple cores, and involves the use of a different garbage collector in the program. Unless you actually write your program to use the multithreaded commands there really is no benefit in enabling that flag. Build GUI app will prevent your program from trying to open a console window on launch, and for 99.9% of programs you want to check that option. Quick Build will prevent Blitzmax from re-compiling all the dependencies that it thinks haven't changed since your latest compile. Enabling it will decrease your compile times, but you may have weird behaviour if you updated any libraries, minGW, or blitzmax versions since the last compile. |
| ||
Thanks Jesse please use strict or SuperStrict. I know how important it is and Should be using it! :) There is one things that I didn't know was that you can put Constant inside Type which was interesting... There is another things that also different is that you used Methods where I used Functions.... Interesting :) Thanks for Information xlsior :) Last edited 2011 Last edited 2011 |
| ||
Methods accesses the fields, methods and fields can only be accessed when the object has been instantiated. you can access the function with out having created an instance of the class but the fields will not be accessible through the function wether its been instantiated or not. [ Last edited 2011 |
| ||
Methods accesses the fields, methods and fields can only be accessed when the object has been instantiated. you can access the function with out having created an instance of the class but the fields will not be accessible wether its been instantiated or not. I see....Interesting :) |
| ||
have you been trough the OOP tutorials in the tutorials section? Last edited 2011 |
| ||
I don't know if this is smaller, but sure it's faster :)Method draw() For Local a# = 1 To 600 Step 2 Local aa#=(a/amp) + ang Local s1#=Sin(aa)*100 Local s2#=Sin(aa+90)*100 x1= s1 + 300 x2= s2 + 300 x3=-s1 + 300 x4=-s2 + 300 If x1<x2 SetColor 255,0,255 DrawLine x1-Pos1,a,x2-Pos1,a;DrawLine x1+Pos2,a,x2+Pos2,a Else ' x3 < x4 SetColor 0,255,0 DrawLine x3-Pos1,a,x4-Pos1,a;DrawLine x3+Pos2,a,x4+Pos2,a End If If x2<x3 SetColor 0,0,255 DrawLine x2-Pos1,a,x3-Pos1,a;DrawLine x2+Pos2,a,x3+Pos2,a End If If x4<x1 SetColor 255,255,0 DrawLine x4-Pos1,a,x1-Pos1,a;DrawLine x4+Pos2,a,x1+Pos2,a End If Next ang=ang+2 End Method Edit: optimized a little bit more, now for sure it will be smaller :) Last edited 2011 |
| ||
Don't be rude, I was only trying to help. you didn't say you'd used upx, you just mentioned compression, and in not very good English grammar either. So don't ask if you're just going to moan at answers you get. For all I know you meant WinZIP! |
| ||
The BlitzMax IDE couldnt Compressed(well the Files size would be 1.33MB!) itself when You make a program hence why It been Compressed(i.e. everyone know it from Upx!) in not very good English grammar either. My English is'nt great as it took me 11 Years of English(From age 3 to 14!) to my get Speech(and writings) up to hearing World Standard(yes..My speech is hell of better than what I write or type on here(it is Hard to explain on different between the two but if I take you to Doncaster College for deaf and look round what all those deaf people do and see the different on their English Grammars and also their speech! It will OPEN YOUR EYES for sure!! There is no way that Winzip could Compressed from 1.33MB down to 615k...impossible! P.S. Thanks for change Code SLotman :) P.S.S. It take while to get round the OOP Jesse:) Last edited 2011 Last edited 2011 Last edited 2011 |
| ||
Winzip can compress text much better than that :) Try creating a text file, filled with '0', and watch it disappear before your eyes :) (Once I compressed a 100mb 'empty' file into a few kb) |
| ||
I thought Winrar is much better than Winzip is'nt it? |
| ||
You have more pressing matters then the size of your program to consider...Global _Draw:Twister=New Twister Function twister()Screws a lot of conventions and OOP concepts. Also speed is almost always more important than size. (i.e. everyone know it from Upx!) Never heard from Upx (and I've looked into compression). |
| ||
Never heard from Upx (and I've looked into compression). That surprises me -- UPX really is -the- executable packer out there, and is commonly used. Blide even has an option to automatically compress generated exe's with UPX. |
| ||
That surprises me I looked at it and now that surprises me as well. Still, looking at the original post, andy_mc made a very sensible suggestion getting an insensible reply. |
| ||
It's good to know how to use the framework and import commands to get your executable size down. However, in general I wouldn't use them in your programs for every day developing and experimenting. You will waste time micromanaging which imports you need or don't and they will change all the time. I'm sure your harddrive can take the extra 500k :) So know it exists, ignore it, until you release your game to the public, and then do it! It also puzzles me when people put them in code samples they share on the forum. You are not sending the exe itself, and it just complicates the example which usually has nothing to do with a question on the import commands! Last edited 2011 |
| ||
I agree with all you mentioned Czar with the exception that some websites have a limit on file size and I think hotshot needs it to upload it to to a website that has a limit to the file size which can be uploaded to it. I believe the file size is under 200k bites. Last edited 2011 |
| ||
That is release to the public ;) |
| ||
Check out FrameWork Assistant http://homepage.ntlworld.com/config/fa/ It will help you figure out what modules you need to import. Thanks @TomToad |