1. Win32Lib overhead

This is a multi-part message in MIME format.

--Boundary_(ID_Ut4QwY6VZxrFiJIyJXqD2w)

Hi All,
If I write a program using Win32Lib, then translate and compile it, will
    there be an over head from all the declarations and routines in win32lib.ew? I'm
    trying to make my programs extremely portable, and some of them come out to be in
    the range of 200K for faily simple apps. I guess what I'm really asking is "Is
    Win32Lib or direct API coding better?"

~Greg
g.haberek at comcast.net

--Boundary_(ID_Ut4QwY6VZxrFiJIyJXqD2w)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi All,</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; If I write a program using 
Win32Lib, then translate and compile it, will there be an over head from all the
declarations and routines in win32lib.ew? I'm trying to make my programs 
extremely portable, and some of them come out to be in the range of 200K for 
faily simple apps. I guess what I'm really asking is "Is&nbsp;Win32Lib or direct
API coding better?"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>~Greg</FONT></DIV>

--Boundary_(ID_Ut4QwY6VZxrFiJIyJXqD2w)--

new topic     » topic index » view message » categorize

2. Re: Win32Lib overhead

Greg writes:
> If I write a program using Win32Lib, then translate and compile it,
> will there be an over head from all the declarations and 
> routines in win32lib.ew?

Both the translator and the binder strip out all unnecessary code.
For example, when I bind your textview program,
it says:
      deleted 2154 of 3816 constants
      deleted 382 of 659 routines
That still leaves a fair bit of necessary infra-structure for Win32Lib.

> I'm trying to make my programs extremely portable, and some
> of them come out to be in the range of 200K for faily simple apps.

Using your textview as an example,
   bound .exe: 182,215
   translated .exe: 642,560
   translated and UPX'd .exe: 162,304

In comparison, if you compile a trivial console app:
   main()
   {
       printf("Hello World!\n");
   }
with Borland C++ for Windows, you'll get a 52K .exe file.

The binder combines exw.exe, which is already compressed with UPX,
with all your Euphoria source code in compact form -
comments and whitespace stripped, variables shrunk to one or two bytes etc.
This gives you a very compact .exe.

With the translator, your program is converted to C and then
to machine language. This is not very compact, but UPX
will shrink it considerably. Translated code is faster, but if
your program is heavy on GUI, and light on calculation, it might
not matter.

> I guess what I'm really asking is "Is Win32Lib or direct API
> coding better?"

Win32Lib is a lot easier. Others (Euman?) can comment better
on the trade-offs.

By the way, if you see a line at the end of Win32Lib.ew
that is just two dashes: -- (and no new-line character),
you will need to remove it before binding with 2.3. This problem
has been fixed in the upcoming 2.4 binder.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib overhead

Thanks for the heads up. I forgot about UPX, its been a while since I've had
to compile C code, I guess Euphoria's been distracting me from it
recently... :)

~Greg

----- Original Message -----
From: "Robert Craig" <rds at RapidEuphoria.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Win32Lib overhead


>
> Greg writes:
> > If I write a program using Win32Lib, then translate and compile it,
> > will there be an over head from all the declarations and
> > routines in win32lib.ew?
>
> Both the translator and the binder strip out all unnecessary code.
> For example, when I bind your textview program,
> it says:
>       deleted 2154 of 3816 constants
>       deleted 382 of 659 routines
> That still leaves a fair bit of necessary infra-structure for Win32Lib.
>
> > I'm trying to make my programs extremely portable, and some
> > of them come out to be in the range of 200K for faily simple apps.
>
> Using your textview as an example,
>    bound .exe: 182,215
>    translated .exe: 642,560
>    translated and UPX'd .exe: 162,304
>
> In comparison, if you compile a trivial console app:
>    main()
>    {
>        printf("Hello World!\n");
>    }
> with Borland C++ for Windows, you'll get a 52K .exe file.
>
> The binder combines exw.exe, which is already compressed with UPX,
> with all your Euphoria source code in compact form -
> comments and whitespace stripped, variables shrunk to one or two bytes
etc.
> This gives you a very compact .exe.
>
> With the translator, your program is converted to C and then
> to machine language. This is not very compact, but UPX
> will shrink it considerably. Translated code is faster, but if
> your program is heavy on GUI, and light on calculation, it might
> not matter.
>
> > I guess what I'm really asking is "Is Win32Lib or direct API
> > coding better?"
>
> Win32Lib is a lot easier. Others (Euman?) can comment better
> on the trade-offs.
>
> By the way, if you see a line at the end of Win32Lib.ew
> that is just two dashes: -- (and no new-line character),
> you will need to remove it before binding with 2.3. This problem
> has been fixed in the upcoming 2.4 binder.
>
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Lib overhead

Hi Greg,

----- Original Message -----
From: <g.haberek at comcast.net>
To: "EUforum" <EUforum at topica.com>
Subject: Win32Lib overhead


>
> Hi All,
>     If I write a program using Win32Lib, then translate
> and compile it, will there be an over head from all the
> declarations and routines in win32lib.ew? I'm trying to
> make my programs extremely portable, and some of them
> come out to be in the range of 200K for faily simple
> apps.
> I guess what I'm really asking is "Is Win32Lib or
> direct API coding better?"
>

By "portable" I assume you mean "small enough to fit on a diskette".

With the current monolithic win32lib.ew approach, any bound program is going
to be a minimum of 160K. This is due to the inclusion of many routines and
identifiers that may not be being used by your app. This effects size and
not speed of course.

In future, you will have more opportunity to mix-and-match the win32lib
functionality to your apps requirements, giving you the possibility of
leaving out those elements that you are not using.

As I see it, the benefits of the win32lib and Andrea Cini's execellent
euwingui library, is that it is easier to create and maintain programs with
these - at the cost of size and execution speed.

Going with the WinAPI approach, you will certainly be able to create smaller
and faster executing programs - at the cost of more of your time to create
and maintain them. Overtime, however, you will also be able to build up a
collection of files to make your own "win32" library - rather than
reinventing the wheel for each new app.

However, if you are really serious about making small Win32lib apps, you
should take a look at Masm32 - an excellent way of producing assembler based
win32 apps.

----------------
cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32Lib overhead

: Rob Craig writes

: Win32Lib is a lot easier. Others (Euman?) can comment better
: on the trade-offs.

API programming is difficult because, most of your time is spent
weeding thru the MS Platform SDK whereas Win32lib has a
nifty helpfile that comes with the package.

True, API code will be the fastest and the smallest generated code
but as Derek said earlier,

I quote:
"Going with the WinAPI approach, you will certainly be able to create
smaller
and faster executing programs - at the cost of more of your time to create
and maintain them. Overtime, however, you will also be able to build up a
collection of files to make your own "win32" library - rather than
reinventing the wheel for each new app"

The "Overtime, however" means several things.
1) you will spend alot of "Overtime" creating a simple program
2) "However", that code will be yours to keep.
3) you wont have the need to wait for someone else to produce
    another release to either fix a bug or add new features because,
    you'll have the knowledge to read the SDK and figure things
    out on your own.

I wish there were more API programmers that were willing to create plugable
modules. My treeview and listview routines for example, they're modular
but you still need to do some work inside your main program to handle using
them. All the constants and structures are defined and noone will ever have
to
touch this work again. Its sortof the approach Win32lib is about to take on.
"Why it took so long for this to happen is simply because it too is written
using
 the API as a base to make it easier for everyone."

I guess my answer would be: use Win32lib to not learn anything and be put on
hold
waiting for releases or, actually do the work yourself.  Myself and many
others have
written alot of modular code that you can use. Jut take the time to learn
API and you'll
be happier with the results.

This is an oppinion I have because Im happier coding direct API but, I still
use
Win32lib for certain projects that must go out the door quickly.

You decide!
Euman

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu