Re: Optimizing size of executable

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here is an alternative description of how Euphoria works:

Program Sizes

All Euphoria programs have "overhead" that provide features like: safety, type-checks, index-checks, memory management, and garbage collection. These are all desirable features that you get for simply using Euphoria.

This short Euphoria program

puts(1, "Hello Euphoria!" ) 

is a 28 byte text file; save it as hello.ex". The Interpreter (2.3 MB) will execute this program for you.

eui hello 

Interpreting is a two stage process: first source-code is parsed into il-code (intermediate language), second the il-code is interpreted and executed. The .il-code process strips out unused library routines and variables. The Interpreter executes source-code written in plain text which is ideal for program development.

You can save a program as an il-code file and execute it later.

eushroud hello 

The result is hello.il**, a 532 byte file, that is no longer human readable.

The il-code is executed by

eub hello 

the back-end (eub) is a 2.2 MB file. You can provide users with one eub file and compact "applications" in the form of .il files. A user can neither examine your source-code nor tamper with the .il files.

The binding process will combine a back-end with .il code to make a stand-alone executable:

eubind hello 

The result is hello (Unix) or hello.exe (Windows). In this example the executable is 2.3 MB, which is the binder plus the size of the .il code. The advantage of binding is that it is quick and you do not need to install a C-compiler.

You can translate Euphoria source-code into 'C' source-code:

euc -keep hello 

You get a folder containing eight files with a total size of 11.9 kb, and hello a stand-alone executable of 210 kb. Execute the application as:

$ ./hello  
	-- Unix 
 
# hello 
   -- Windows 

When you launch euc without the -keep option the intermediate 'C' files are cleaned up for you.

If you write non-trivial programs the sizes mentioned here grow slowly. The source-code component is actually compact and large programs do not increase in size very much.

_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu