This is a migrated thread and some comments may be shown as answers.

Optimising by Compiling with winform source code

5 Answers 172 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ewart
Top achievements
Rank 1
ewart asked on 02 Feb 2009, 03:02 AM
Hi Telerik + others, I'm thinking of compiling our winform app with the telerik source code rather than the raw telerik DLL's, my assumption here being there will ne a way in which I can do this and get the compiler to eliminate unused deadcode branches.

At the moment we're distributing at least 10mb of telerik pre-compiled libraries and i figure there is a lot of telerik code I'm probably not using that could be removed.

Has anyone else tried this approach or have any useful comments/advice?

Regards
   Ewart.

5 Answers, 1 is accepted

Sort by
0
Mike
Telerik team
answered on 05 Feb 2009, 07:47 AM
Hi Ewart,

We are currently investigating an approach to reduce the size of our assemblies, by removing some unneeded xml resource files. We found a way to compile some of the theme files for example, as code. This will result in reducing the size of some dlls nearly in half. Another things you should consider distributing assemblies with themes that your app is not using. This should be available with the next release (Q1).

As to recompiing the source code with your app - we believe it is resonable and you can achieve good result. However currently we do not have any experience with similar cases. Nevertheles we will help you with anything we can if you consider this approach.

Best wishes,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
ewart
Top achievements
Rank 1
answered on 05 Feb 2009, 07:59 AM
Thanks Mike your comments apreciated.  I look fwd to the Q1 release, sounds like it will make a huge difference to the download size..  I would like to additionally look at compiling with the telerik source at some point to further reduce the overhead.

cheers
ewart
0
ewart
Top achievements
Rank 1
answered on 05 Feb 2009, 10:12 PM
HI everyone, out of curosity I've just done a quick test to see how easy this would be, and the answer is, pretty easy. I had an overall 10% saving in compressed output size.  I thought I'd share the result, with the community as I don't believe anyone else as done this before (or at least shared their results).

I downloaded the Telerik source code and it converted seemlessly to Visual Stuidio 2008.  Not wanting to mess with my existing application config I created a new solution folder inside the RadControlsSource and attached a copy of the projects from my app's solution.  I then removed my projects references to the existing telerik binaries and added project references.  I had some build errors which were resolved by installing .net framework 2.0 SDK.  Telerik it would be worth putting a readme.txt in the root directory.saying you need to install this before attempting to compile,

After that, no big problems (I couldn't get RadChart to compile with my app so I used the production dll), a few build warnings (837), but otherwise no errors and all the newly compiled telerik dll's shrunk in size when compiled! 

The biggest saving was Telerik.WinControls.UI.dll which dropped from 5,676kb to 3,690kb, whilst the rest were smaller savings, e.g. Telerik.Wincontrols.dll from 1764kb to 1444kb.  My apps .exe did however grow in size from 4773kb to 5062kb.  Overally I saved about 2.5mb from 15.8mb.

I hav't yet tested the effect once my executable is packaged up as this will compress everything anyway - (a hassle to do right now as I'd have to hange all my pre and post build scripts etc).  I did however quickly winzip both the new and old outputs to see how they compress, the old winziped to 8.1mb and the new to 7.23mb.   My output package size is normally 8.0mb so it would be fair to expect 870kb to come off the compressed package using the new dll's, about a 10% saving.  In download terms this is is huge if your on the otherside of the world with a slow broadband connection, or even worse dial up!  Count yourself lucky if your getting 1mb per second download ;)

I'm highly confident that I could do more to reduce my output size; I'd love to return to this experiment when I have more time.  Even in the shrunken output I see that the compiler has choosen to include resources I'm pretty sure I'm not referencing, for example a "RadControl\Resources\telerikLogo2.bmp" is a 57kb bitmap (8kb if i convert it to png) which won't be used by my new app - Microsoft probably have some work to do in terms of DCE.

I additionally ran XenoCode over the output as a quick way to try and reduce the size futher but as you'd expect there are a lot of public entrypoints so I think a lot of experimentation would probably only save a small chunk.  If I understand correctly, the more entrypoints we mark as private or internal the higher the chance xenocode can detect/eliminate unused code in a postbuild op.

I see what you mean about the XML files, it's great you guys are already onto optimising that, keep up the good work.  

Hopefully someone will find this contribution useful!  I was really impressed with just how easy it was to compile the Telerik source, it really is an option if you need to go the extra mile for optimisation. 

Regards
  Ewart.
0
Mike
Telerik team
answered on 09 Feb 2009, 09:04 AM
Hi Ewart,

Thank you very much for the effort and for the detailed report. Points in your account have been updated a small token of our appreciation. Further we will continue with researching options for reducing the assemblies size at our side. Hopefully we will have results for Q1.

Kind regards,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Arie Segev
Top achievements
Rank 1
answered on 06 Aug 2009, 11:34 PM
I was referred to this post in a reply to support ticket I posted, so I thought it would be useful for everyone if I post here my Q and Telerik's A.
---------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Arie Segev
  • Posted on 1 day ago

    As you must know the biggest problem with the WinForms controls is their monolithic size which makes it non-usable for for small apps under .net 2.0/winxp. By none usable I mean that it unacceptable to the user to get a 14MB executable where the same implementation (without the wpf-like features) under the vanilla .net2.0 results in 1mb or less. I have raised this issue couple of years back but did not expect a change given the shifting priorities towards .net > 2.0.  So while the current version has more features and improved performance, the issues with controls' granularity remain the same.
    To make it usable for some cases I thought of modifying the source. The objective is not to add or modify functionally but to selectively remove 'heavy'  portions which are not needed. I don't know if trying to do so will be successful or how generic/reusable the results will be, but given the effort involved I don't want to start pursuing it unless I get permission from Telerik to distribute such modified DLLs as part those small apps (if they ever reach that stage). I don't mind passing any such modified code to Telerik for whatever use you might have, be it functional or just for tracking reasons.

    Please let me know.
    Thanks, Arie
  • Posted on 7 hours ago

    Hello Arie,

    We understand your point of view. Generally, you are allowed to modify the source code and distribute your application with the modified assemblies. The key that signs the assemblies built from the source code and the key that we are using to sign and distribute the official Telerik assemblies are different. So, when you modify the source code and then build your version of Telerik assemblies, it will be clear that these are not the official assemblies.

    Please note that we do not support RadControls built from the source code. When you want to report an issue, make sure that this issue occurs when using the official Telerik assemblies.

    You can check this forum post where a customer of ours - ewart - describes his experience with modifying the source code.

    I hope this helps. If you have additional questions, feel free to contact me.

    Best wishes,

    Nikolay
    the Telerik team
    .
Tags
General Discussions
Asked by
ewart
Top achievements
Rank 1
Answers by
Mike
Telerik team
ewart
Top achievements
Rank 1
Arie Segev
Top achievements
Rank 1
Share this question
or