larger executable building with DWT-WIN

John Reimer terminal.node at gmail.com
Sun Mar 2 21:59:42 PST 2008


yidabu wrote:

> larger executable building with DWT-WIN
>     
> A helloworld.exe build with DWT-WIN (-release), the executable size is
> 1.93 MB :
>     
> import dwt.widgets.Display;
> import dwt.widgets.Shell;
> 
> void main ()
> {
> Display display = new Display;
> Shell shell = new Shell(display);
> 
> shell.setText = "Hello DWT World";
> shell.open;
> 
> while (!shell.isDisposed)
> if (!display.readAndDispatch)
> display.sleep;
> 
> display.dispose;
> }
> 
> 
> 
> build with DFL (-release), the exectuable size is 284 KB :
>     
> import dfl.all;
> 
> int main()
> {
> Form myForm;
> 
> myForm = new Form;
> myForm.text = "Hello world";
> 
> Application.run(myForm);
> 
> return 0;
> }
> 
> Anybody now What's cause this,  How larger executable size building with
> DWT-WIN ?
> 
> 
> 

It's bigger for several reasons (in no particular order):

1) DWT is much larger than DFL with many more widgets.  This means more
power... at a cost.

2) DWT supports multiple windows platforms in one library; this means it
contains specific support for both win98, windows XP, and Vista (among
others).  This means more code; the advantage is that binaries built with
dwt are more likely to be compatible with all windows platforms.  The
disadvantage, of course, is extra bloat.

3) The porting emphasis for DWT has been to "get it working"; little work
has yet gone into optimizing it for size.

4) DWT has a extensive network of interdependencies among it's modules and
many of its widgets have complex inheritance structures; it's almost like
spaghetti to put it plainly.  This forces a large number of objects to be
linked in that aren't necessarily visibly used.  This is probably not the
case with dfl, which has a decidedly lean profile since it was built from
scratch for D (not ported from a large Java project).

5) Porting from Java means adopting a large number of mechanisms that aren't
strictly necessary in D.  This style forces a larger footprint on DWT. 
Some other mechanisms are important for exception recovery and thread
safety.

That said, there is a plenty of opportunity for size improvement in DWT that
hasn't even been touched yet.  It will never shrink to the size of DFL, but
I imagine we can slim it down a bit from it's current size.  There are some
cleanup techniques still waiting to be applied to the code base.  

Even so, please understand that DWT, like SWT, is a large GUI library and
does not compete directly with DFL.  DFL wins hands down for size,
simplicity, and clean-coding.  DWT, I think, is a power-house of features
and will reach audiences that are a little more "greedy" for cross-platform
support and comprehensive GUI interface design in their applications. :)

-JJR





More information about the Digitalmars-d-dwt mailing list