Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Mad Compile Time Optimizer - Speed up your development!

Discussion in 'Assets and Asset Store' started by genail, Apr 16, 2015.

  1. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Please send me your invoice number to support@madpixelmachine.com if you'd like to test this version. It may be unstable, so if you're not using version control system I strongly discourage trying it :)

    @iamsam Thanks! I will greatly appreciate testing of this version. I don't want to release something that will break anyone's project. It's just too important to have this working all the times.

    Everyone be careful though. I cannot guarantee that Unity upgrades won't break anything. Of course we have the access to beta and RC released, but as Unity 5 were released the final version were different than the last RC version for some reason. Backups and/or SCM for the life!
     
  2. gskinner

    gskinner

    Joined:
    Aug 28, 2014
    Posts:
    42
    Thanks @genail, the dependencies weren't external to the libraries, it was the libraries themselves that were missing.

    For example, after omptimization, the InControl namespace was just missing, so all my projects scripts referencing that namespace had errors. I tried rebuilding the VS Project Files, and relaunching unity, but nothing seemed to work.

    Good news is, this morning I re-optimized them, and everything just worked.. weird!

    In terms of version of Unity, I'm currently on 5.1.2.
    Cheers,
     
  3. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Have you seen this error only in Visual Studio or in Unity too?
    From my experience Visual Studio project may not get refreshed sometimes.

    Anyway, good to hear that the problem is solved! :)

    Cheers!
    Piotr
     
  4. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    I just bought the asset when I read this, it's the main thing that prevented me from purchasing in the past, looking forward to the update!
     
    genail likes this.
  5. dayero

    dayero

    Joined:
    Jan 27, 2014
    Posts:
    45
    I just bought and tested this.
    For convienience I just quickly optimized my biggest assets which are
    - Playmaker (+ ITween)
    - Behavior Designer
    - Inventory Pro
    - 2D Toolkit

    Compile time went down from ~9400 to ~4700. Pretty nice for just a few minutes of trial and error.
    However i am left with a weird "Do Upgrade" item in the tools tab. Inventory Pro briefly disappeared from there.
    Any idea which asset leaves that item? Or is it the Optimizer itself?

    First impression is that this asset is well worth it. Even if it takes a while for 4-5 seconds to add up to anything substantial, imho it's also a matter of user experience. Spending some time once to optimize is much less annoying than spending the same time waiting in 5 second chunks.
     
  6. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    389
    Hi, a bit confused about things behind MCTO.
    1. My new game use a lot of assets(more than 10), but I don't feel significant difference. That makes me wondering what exactly "compile time" means. Is that means each time I hit "Play" or "compiling" after edit some scripts?
    2. When will optimized scripts get compiled? Is that base on a "dirty" property?
    Thanks.
     
  7. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Thank you for purchasing MCTO :)

    Unfortunately I don't know what asset is responsible for this :-( Is this in the main menu? Search in the source files for "Do Upgrade" text.

    @zhuchun

    1. Compile time means the time needed for your project to recompile after your game scripts has been changed.
    2. These are compiled right after the optimization. The whole thing is to not compile these scripts as frequently as your own scripts. MCTO is separating 3rd party scripts so these can be compiled only once from your own scripts that are changed more frequently :)

    Cheers!
    Piotr
     
    zhuchun likes this.
  8. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    31
    Hi, I just purchased this. Thanks, so far it has shaved off a few seconds. However i am getting an error regarding duplicate keys on every compile. I'm using Unity 5.2:


    Code (CSharp):
    1. ArgumentException: An element with the same key already exists in the dictionary.
    2. System.Collections.Generic.Dictionary`2[System.String,MadCompileTimeOptimizer.Directory].Add (System.String key, MadCompileTimeOptimizer.Directory value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    3. MadCompileTimeOptimizer.OptimizeWizard.LoadSelected ()
    4. MadCompileTimeOptimizer.OptimizeWizard.OnEnable ()

    If I could see which keys are duplicted I might be able to fix it.

    Thanks.

    p.s I also get the "Do Upgrade" text in my menu.
     
  9. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!,
    Thank you for purchasing MCTO.

    This is... not possible! This would mean that there are two directories with the same GUID... Or the scanner is faulty...
    Can I ask to send me your project? Please also write to me to support@madpixelmachine.com with your order no. I will send you the sources.

    Cheers!
    Piotr
     
  10. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Hi,

    I bought Mad Compile and were using happily in my current project, until today, when I had to revert the optimizations for the first time, in order to update a plugin (Master Audio). I went to the Revert menu and, agh:

    madCompileError.png

    Where should these logs be? What do I do? :O I can assure you that I'm not crazy and I optimized various assets (which are now partly in the Standard Assets folder, plus Mad Compile correctly tells me that there's nothing to optimize anymore for those original assets folders - including the Dark Tonic Master Audio original folder).
     
  11. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hello Izitmee,

    What MCTO version do you have? Logs can be found inside Mad Compile Time Optimizer/Resources directory. Can you send me zipped Mad Compile Time Optimizer directory to support@madpixelmachine.com?

    Cheers!
    Piotr
     
  12. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Thank you, mail sent!
     
  13. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    OK I know what happened. For some reason main DLL file GUID has changed. You've said that you've removed your Library directory once. Did you have "Visible Meta Files" option enabled at the time being? If not, all the GUIDs in your project were regenerated and all references lost. Check your scenes, materials etc.

    Of course there's other possibility like you accidentally remove meta files (what you shouldn't do under any circumstances).

    You can recover MCTO from this situation. Follow these steps:

    1. Move Mad Compile TIme Optimizer/Editor/Resources somewhere outside MCTO directory:

    upload_2015-10-4_11-42-7.png

    2. Remove Mad Compile Time Optimizer directory and import it again from the asset store.

    3. Move back only the *log files.

    upload_2015-10-4_11-44-0.png

    4. Remove old Resources directory (the one outside MCTO directory)

    Revert should now be working :)

    upload_2015-10-4_11-44-38.png

    Please let me know what about references in your scene, materials and prefabs, are these gone too? This is not MCTO fault of course, but I'd like to understand what happened here.

    Cheers!
    Piotr
     
  14. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Hi!

    Thanks for the instructions, gonna try it now. Before that, some more info...

    If it's a GUID issue, I agree it must not be an MCTO issue, but it's still very strange. I use "Hidden Meta Files", but just because I have set my system to show hidden files, and that way they're actually more visible. The meta files are correctly versioned and I lost no other reference. I use this workflow since always, never versioned the Library, and never lost a reference when regenerating the Library (not only on personal projects but also on team projects), so I'm kind of puzzled here.
    I'm also sure I didn't remove any meta accidentally.

    Anyway, going to try your fix now, crossing my fingers :) Will let you know in a short while.

    Cheers!
    Daniele
     
  15. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    It worked! :) Though, I have an error now (but MCTO seems to be working correctly anyway) that is spawned each time I open or recompile the project or get into play mode:

    Code (csharp):
    1.  
    2. ArgumentException: The Path does not have a valid format
    3. System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/Directory.cs:487)
    4. System.IO.Directory.GetFiles (System.String path, System.String searchPattern) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/Directory.cs:308)
    5. System.IO.Directory.GetFiles (System.String path) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/Directory.cs:303)
    6. MadCompileTimeOptimizer.Upgrade.DoUpgrade ()
    7. UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:280)
     
    Last edited: Oct 4, 2015
  16. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    @Izitmee
    Do you use any Version Control System? Please verify when and why meta files has been changed.

    The error above is because is expects the Resources directory to have GUID equal to dd9b419ee69821549bc79933423c6d37. Please edit the Resources.meta file and change the guid in there to dd9b419ee69821549bc79933423c6d37 and the error should be gone :)
     
  17. Izitmee

    Izitmee

    Joined:
    Jan 27, 2011
    Posts:
    3,228
    Ah, I see. Fixed, now working perfectly :)

    I use GIT, and the Resources GUID was correctly changed when I deleted the MCTO folder as you told me and reimported it again (since the original Resources GUID was already taken by the folder you told me to move outside of MCTO ;)). All great now thanks, time to write a nice review.
     
    genail likes this.
  18. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Strange why this happened though...
    Well... The important thing is that this is working now! :)

    Thank you! :)
     
  19. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    52
    Hey :),
    Is it possible to add (screenshot from the optimize window):
    upload_2015-10-7_17-58-23.png
    to the revert window too?
    I want to have a cleaned up folder structure, and I don't want to revert all assets inside a single folder each time, like this:
    upload_2015-10-7_18-2-51.png
    Thanks in advance, John
     
  20. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    I believe this can be done by selecting each asset separately :)

    Instead of selecting your Asset entry for optimization, please select all its children individually.

    If this is now what you're looking for, please let me know :)

    Cheers!
    Piotr
     
  21. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    52
    Hey,
    Thanks for your fast reponse!

    That's it. :D
    Sorry, should have tried that before. ;)
    Reduced my compile time from 12 seconds to 2.5 seconds (I'm using 14 assets currently), that's an cool improvement of 480%, great! :cool:

    Best wishes,
    John
     
    genail likes this.
  22. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Wow! I think this is the record :)
    Please let me know if you will need anything!

    Have a nice day!
    Piotr
     
    johanneskopf likes this.
  23. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,183
    @genail I had a look at your video for Mad Compile Time Optimizer and had one question for you. After we optimize the other plugins into the Plugins or Standard Assets folders, can we delete the original folders they were copied from?

    For example we optimize the iTween folder from the root folder to the Plugins folders, can we then delete the iTween folder in the root?
     
  24. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hello @Ben BearFish
    It depends.

    MCTO is leaving the original directory structure where it was, because some scripts may:
    • Depend on it
    • Have some other assets in there
    MCTO can rectore this direcotry structure when you will revert your assets, but deleted files that are not scripts won't be restored. It's always safer to keep the original directory where it is :)

    Cheers!
    Piotr
     
  25. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    When trying with MarkUX(it's in asset store), MCTO failed.
    It failed while optimizing and can't revert well.
    Could you check this, genail?
     
  26. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi! Please write to me to support@madpixelmachine.com .
     
  27. RDeluxe

    RDeluxe

    Joined:
    Sep 29, 2013
    Posts:
    94
  28. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi! @RDeluxe
    I'm glad that I or something I am doing could be an inspiration to anyone :)

    Unfortunately I'm not planing to add DLL compilation feature to MCTO, but if you're interested, I wrote some ruby scripts that are helping me compiling my code into dlls with only one command. If you will need any help with these, please PM me or write to support@madpixelmachine.com :)

    Cheers!
    Piotr
     
  29. RDeluxe

    RDeluxe

    Joined:
    Sep 29, 2013
    Posts:
    94
    Hi !

    Well, I played around with uTomate and managed to compile everything (witout keeping guid links, which broke all my components, but I was first testing performances). Compared to just moving scripts in the Standard Assets folder, the performance gain is minimal as far as I can see. I updated my topic to reflect this, I guess I'll try to automatize the process (or buy your asset, if I don't have time to play around :D )

    Thanks for your answer, I already found your scripts. I don't understand Ruby at all (what a weird syntax !) but the process helped me a lot.
     
    genail likes this.
  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Good luck! :)
    Inside my scripts you can find code that is responsible for re-linking the GUIDs. If you compile a script it receives a new GUID based on dll file id and a script name. If you will have any questions about that, please write to me anytime :)
     
  31. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    Hello, genail.
    After upgrade 5.2.3p3 from 5.2.2p2, mad compile time optimizer doesn't work anymore.
    Does unity change the way of compiling?
     
  32. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!

    What exactly is happening?
     
  33. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    Compiling time is same between pre-optimization and post-optimization.
     
  34. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    I don't see why this may be happening :-(

    upload_2015-12-21_11-40-50.png

    7660 - warm-up
    4XXX - before optimization
    5751 - warm-ip after optimization
    2XXX - after optimization

    Could you please send me screenshot of your Optimize window? I'd like to see what assets you have out there and what is optimized.

    Cheers!
    Piotr
     
  35. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
  36. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Yep, it's broken. But that's not my fault. For some reason Unity 5.2.3p3 is forcefully recompiling all assemblies, even those with unchanged files. I believe it is a Unity bug, because for 5.3.0 it is working just fine.

    Unity lately has changed how and when files are recompiled. Is file has been changed, but contents remain the same, Unity won't recompile the assembly. This is a good change, but it looks like someone did the merging incorrectly :)

    Please report it, and/or downgrade or upgrade your Unity installation to 5.3.0.

    Piotr
     
  37. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    I am very happy by hearing 5.3.0 is ok.
    Although I can't use 5.3.0 now, I got peace of mind.
    Thank you very much.
     
  38. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    67
    I'm having some trouble using this with Apex Path. Some AP components utilize "Entity Attributes", which can be defined by creating a specially flagged enum yourself or with a utility which will automatically create one for you. For some reason, optimizing Apex Path prevents its components from finding this enum. The enum, or at least the one created by the utility anyway, exists in a file that is located in the root folder of the project.
     
  39. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hello Lork,
    That's because when you're optimizing an asset, it is moved to different assembly. Main assembly sees all the code but editor scripts. After optimization it is moved to Plugins assembly that sees only another Plugins code. In theory to make it work you will have to move generated enums to Plugins/Standard Assets directory (depending where you're optimizing Apex Path).

    If this won't help, please leave Apex Path unoptimized. This also applies to other assets which are doing similar things with scripts.

    Cheers!
    Piotr
     
  40. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    67
    That makes sense. Moving the file to the right directory fixed things up, thanks!
     
  41. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    213
    I've been trying to reduce 20 second compile times with a big project that uses Playmaker- Could this asset reduce this time? :) If so- I can still upgrade Playmaker and use it normally once it is optimized? Thx!
     
  42. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi @mdotstrange ,
    It can be used with Playmaker, but remember that you have to optimize all classes that Playmaker may use. Playmaker scans for actions and if some of them won't be optimized, it won't be able to find these.

    Don't worry if it won't work. Please get back to me then. If I won't be able to help (there are some cases like that) and/or you won't be happy about the results I will refund your purchase :)

    Cheers!
    Piotr
     
  43. mdotstrange

    mdotstrange

    Joined:
    Sep 23, 2013
    Posts:
    213
    Thanks Piotr- just bought it-

    I ran the optimization and I'm getting these errors from some Playmaker actions that I wasn't in the original project-

    So this is because something wasn't included in the optimization?
     
  44. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Most probably yes, but this is first time I see an error like this. Is ArrayListStringJson.cs your own script? What it does?

    Edit: Please write to me to support@madpixelmachine.com.
     
  45. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    12
    I also get "Do Upgrade" in my Main Menu->Tools menu.


    I searched my assets directory and found the source of the message: MadCompileTimeOptimizer.Editor.dll


    I'm using 5.3.5.f1 under windows 7 64-bit and I'm still seeing 17 second compile times after optimization. I guess Unity has decided to recompile all DLL's on every change, even those in the Standard Assets folder.
     
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    Unfortunately MCTO does not work correctly with Unity version higher than 5.3.4f1 due to a bug that recompiles all assemblies on source code change. The bug has been reported and I am hoping for the Unity team to resolve it soon. For the time beign I recommend to downgrade to 5.3.4f1.

    About "Do Upgrade" item. I have to investigate why it is displaying. I'm not sure what it was for... I will investigate it as soon as I will be back from holidays.

    Cheers!
    Piotr
     
    Arkade likes this.
  47. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    588
    Can we add our weight to the bug?

    Sadly 5.3.4 crashes my project. (Although 5.3.5 also does so, it's in a new way!)
     
  48. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
     
  49. RDeluxe

    RDeluxe

    Joined:
    Sep 29, 2013
    Posts:
    94
    There is a note in a patch about this. In 5.3.5p7 :

    • (804864) - Editor: Fixed an issue causing unnecessary script compilation, and improved compilation error handling

    We are downloading and testing now.
     
    Last edited: Jul 15, 2016
  50. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    588
    Oh dear! Wish I'd known this yesterday -- I was at the UK's biggest gamedev conference and there were Unity people there we could have pinned-down / bribed ;-)

    Are you pursuing more information about this via other channels? Again, anything we can do to add voices? (since it can make such a big difference to compile times.)