www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - talk about dwt,jface executable size

reply yidabu <yidabu.spam gmail.com> writes:
dwt hello world size : 1.50 MB
jface hello world size: 2.52 MB

the size is not too big!
the main issue seems too long to build a static library by dsss, this may be a
dsss issue.
I hope that dmd 1.031 will fix the anonymous classe bug and we can use the -lib
build flag to build a static dwt lib, dwtx.lib

tested with dwt-win svn, dwt-addons svn, dmd 1.028
build dwt.lib and dwtx.lib by dsss 0.75
testd on Windows XP


dwt helloworld:

code:

import dwt.widgets.Display;
import dwt.widgets.Shell;
pragma(lib, "dwt.lib");
pragma(lib, "dwtx.lib");
void main ()
{
    auto display = new Display;
    auto shell = new Shell(display);
    shell.setText = "Hello DWT World ";
    shell.open;
    while (!shell.isDisposed)
        if (!display.readAndDispatch)
            display.sleep;

    display.dispose;
}

build command:

dmd test.d dwt.res -L/SUBSYSTEM:windows:5 -L/rc:dwt.res -J..\dwt-samples\res
-J..\dwt-addons\res -release

executable size:
1.50 MB



Jface hello world

code:
import  
    dwt.widgets.Display,
    dwt.widgets.Shell,
    dwt.DWT,
    dwt.widgets.Control,
    dwt.widgets.Composite,
    dwt.widgets.Label,
    dwtx.jface.window.ApplicationWindow;

public class MyWindow : ApplicationWindow
{    
    this()
    {
        super(null);
    }
    void run()
    {        
        setBlockOnOpen(true);
        open();
        Display.getCurrent.dispose;
    }
    
    protected Control createContents(Composite parent)
    {
        auto label = new Label(parent, DWT.CENTER);
        label.setText("hello");
        return label;
    }
    
}

void main(char[][] args)
{
    (new MyWindow).run;
        
}  


executable size : 2.52 MB



-- 
yidabu <yidabu.spam gmail.com>
http://www.dsource.org/projects/dwin

D -(D Chinese):
http://www.d-programming-language-china.org/
http://bbs.d-programming-language-china.org/
http://dwin.d-programming-language-china.org/
http://scite4d.d-programming-language-china.org/
May 23 2008
next sibling parent Frank Benoit <keinfarbton googlemail.com> writes:
Thanks for making this test.

Does it make a difference if you don't do the dwtx pragma in the 
dwt-only hello world?
May 23 2008
prev sibling next sibling parent yidabu <yidabu.spam gmail.com> writes:
On Sat, 24 May 2008 04:52:34 +0200
Frank Benoit <keinfarbton googlemail.com> wrote:

 
 Thanks for making this test.
 
 Does it make a difference if you don't do the dwtx pragma in the 
 dwt-only hello world?

this is my mistake, dwtx pragma is not necessary in the dwt-only hello world. -- yidabu <yidabu.spam gmail.com> http://www.dsource.org/projects/dwin D -(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/
May 23 2008
prev sibling parent reply torhu <no spam.invalid> writes:
yidabu wrote:
 dwt hello world size : 1.50 MB
 jface hello world size: 2.52 MB
 
 the size is not too big!
 the main issue seems too long to build a static library by dsss, this may be a
dsss issue.
 I hope that dmd 1.031 will fix the anonymous classe bug and we can use the
-lib build flag to build a static dwt lib, dwtx.lib
 
 tested with dwt-win svn, dwt-addons svn, dmd 1.028
 build dwt.lib and dwtx.lib by dsss 0.75
 testd on Windows XP
 
 
 dwt helloworld:
 
 code:
 
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 pragma(lib, "dwt.lib");
 pragma(lib, "dwtx.lib");
 void main ()
 {
     auto display = new Display;
     auto shell = new Shell(display);
     shell.setText = "Hello DWT World ";
     shell.open;
     while (!shell.isDisposed)
         if (!display.readAndDispatch)
             display.sleep;
 
     display.dispose;
 }
 
 build command:
 
 dmd test.d dwt.res -L/SUBSYSTEM:windows:5 -L/rc:dwt.res -J..\dwt-samples\res
-J..\dwt-addons\res -release
 
 executable size:
 1.50 MB
 

I tried building this, and got a 1.39 MB exe. It's still quite big. My DWT application is 1.64 MB, which I don't see as a major problem. So the size difference isn't huge between a minimal app and a real app. I built DWT (rev. 211) with dsss, with oneatatime=yes and only '-O -release', no inlining. Then I build the app using bud, with inlining enabled. I don't know how much the inlining matters, since building dwt takes 35 minutes on my pc, I haven't bothered to test much. So I'm really looking forward to dmd 1.031, with a usable -lib switch.
May 24 2008
parent reply John Reimer <terminal.node gmail.com> writes:
Hello torhu,

 yidabu wrote:
 
 dwt hello world size : 1.50 MB
 jface hello world size: 2.52 MB
 the size is not too big!
 
 the main issue seems too long to build a static library by dsss, this
 may be a dsss issue.
 
 I hope that dmd 1.031 will fix the anonymous classe bug and we can
 use the -lib build flag to build a static dwt lib, dwtx.lib
 
 tested with dwt-win svn, dwt-addons svn, dmd 1.028
 build dwt.lib and dwtx.lib by dsss 0.75
 testd on Windows XP
 dwt helloworld:
 
 code:
 
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 pragma(lib, "dwt.lib");
 pragma(lib, "dwtx.lib");
 void main ()
 {
 auto display = new Display;
 auto shell = new Shell(display);
 shell.setText = "Hello DWT World ";
 shell.open;
 while (!shell.isDisposed)
 if (!display.readAndDispatch)
 display.sleep;
 display.dispose;
 }
 build command:
 
 dmd test.d dwt.res -L/SUBSYSTEM:windows:5 -L/rc:dwt.res
 -J..\dwt-samples\res -J..\dwt-addons\res -release
 
 executable size:
 1.50 MB

My DWT application is 1.64 MB, which I don't see as a major problem. So the size difference isn't huge between a minimal app and a real app. I built DWT (rev. 211) with dsss, with oneatatime=yes and only '-O -release', no inlining. Then I build the app using bud, with inlining enabled. I don't know how much the inlining matters, since building dwt takes 35 minutes on my pc, I haven't bothered to test much. So I'm really looking forward to dmd 1.031, with a usable -lib switch.

I can't seem to get a helloworld size nearly that small, so I assume I must be doing something differently. Could you please try using ASpack from here (http://www.aspack.com/downloads.html) and test it on your helloworld example? I'd like to see how small it shrinks. -JJR
May 24 2008
parent reply torhu <no spam.invalid> writes:
John Reimer wrote:
 Hello torhu,
 
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 pragma(lib, "dwt.lib");
 pragma(lib, "dwtx.lib");
 void main ()
 {
 auto display = new Display;
 auto shell = new Shell(display);
 shell.setText = "Hello DWT World ";
 shell.open;
 while (!shell.isDisposed)
 if (!display.readAndDispatch)
 display.sleep;
 display.dispose;
 }
 build command:
 
 dmd test.d dwt.res -L/SUBSYSTEM:windows:5 -L/rc:dwt.res
 -J..\dwt-samples\res -J..\dwt-addons\res -release
 
 executable size:
 1.50 MB

My DWT application is 1.64 MB, which I don't see as a major problem. So the size difference isn't huge between a minimal app and a real app. I built DWT (rev. 211) with dsss, with oneatatime=yes and only '-O -release', no inlining. Then I build the app using bud, with inlining enabled. I don't know how much the inlining matters, since building dwt takes 35 minutes on my pc, I haven't bothered to test much. So I'm really looking forward to dmd 1.031, with a usable -lib switch.

I can't seem to get a helloworld size nearly that small, so I assume I must be doing something differently. Could you please try using ASpack from here (http://www.aspack.com/downloads.html) and test it on your helloworld example? I'd like to see how small it shrinks.

I get 379.5 kB.
May 24 2008
parent John Reimer <terminal.node gmail.com> writes:
Hello torhu,

 John Reimer wrote:
 
 Hello torhu,
 
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 pragma(lib, "dwt.lib");
 pragma(lib, "dwtx.lib");
 void main ()
 {
 auto display = new Display;
 auto shell = new Shell(display);
 shell.setText = "Hello DWT World ";
 shell.open;
 while (!shell.isDisposed)
 if (!display.readAndDispatch)
 display.sleep;
 display.dispose;
 }
 build command:
 dmd test.d dwt.res -L/SUBSYSTEM:windows:5 -L/rc:dwt.res
 -J..\dwt-samples\res -J..\dwt-addons\res -release
 
 executable size:
 1.50 MB

My DWT application is 1.64 MB, which I don't see as a major problem. So the size difference isn't huge between a minimal app and a real app. I built DWT (rev. 211) with dsss, with oneatatime=yes and only '-O -release', no inlining. Then I build the app using bud, with inlining enabled. I don't know how much the inlining matters, since building dwt takes 35 minutes on my pc, I haven't bothered to test much. So I'm really looking forward to dmd 1.031, with a usable -lib switch.

I must be doing something differently. Could you please try using ASpack from here (http://www.aspack.com/downloads.html) and test it on your helloworld example? I'd like to see how small it shrinks.


Thanks! Not that big of a difference from the old dwt executable sizes afterall. :) -JJR
May 24 2008