1. Size of bound files
- Posted by ChrisB (moderator) Nov 30, 2011
- 1219 views
Hi
Could I have this as a feature request for future development, of low urgency.
Size of bound files
I've just bound the following tiny program to quickly detect ip addresses
include std/io.e include std/filesys.e sequence ifile, thiscomp = {}, extaddr = {} system("/sbin/ifconfig > if.txt", 0) ifile = read_lines("if.txt") for i = 1 to length(ifile) do if match("inet addr:", ifile[i]) > 0 then thiscomp = "This computer " & ifile[i][match("inet addr:", ifile[i])..$] exit end if end for system("wget -q http://automation.whatismyip.com/n09230945.asp", 0) extaddr = read_lines("n09230945.asp") extaddr = "External ip = " & extaddr[1] puts(1, thiscomp & "\n") puts(1, extaddr & "\n") delete_file("wget.log") delete_file("n09230945.asp") delete_file("if.txt")
and its come out at 3,476,272 Mb, ie 3.5 megs for a 22 line program.
I know a lot of stuff gets added on, and I could use UPX or gzexe, but even so! There must be a lot of 'useless' stuff that could be stripped out.
As I said, this is a low priority task, but if you could get round to it, it might make a few more fans ('produces tight compact executables')
Chris
2. Re: Size of bound files
- Posted by mattlewis (admin) Nov 30, 2011
- 1176 views
Hi
Could I have this as a feature request for future development, of low urgency.
Size of bound files
I've just bound the following tiny program to quickly detect ip addresses
...
and its come out at 3,476,272 Mb, ie 3.5 megs for a 22 line program.
I know a lot of stuff gets added on, and I could use UPX or gzexe, but even so! There must be a lot of 'useless' stuff that could be stripped out.
As I said, this is a low priority task, but if you could get round to it, it might make a few more fans ('produces tight compact executables')
Snarky answer: Use the translator. (I get a 5MB bound file, and a 500KB translated file.)
Seriously, though, I'm not sure what we would do. The "backend runner" is basically the interpreter back end with a simpler front end. For some reason, it's a bit bigger than the interpreter.
We could provide the backend linked as a shared library. The interpreter and backend runner would then be able to share the same backend at that point. Obviously, this makes it more difficult to share a bound executable, but it would be a lot smaller.
Matt
3. Re: Size of bound files
- Posted by jimcbrown (admin) Nov 30, 2011
- 1175 views
Seriously, though, I'm not sure what we would do. The "backend runner" is basically the interpreter back end with a simpler front end. For some reason, it's a bit bigger than the interpreter.
Figuring out the reason for that, and seeing if it's fixable, might be a place to start.
Of course, that'd only take us so far. I wouldn't expect to shave that much off of eub.
We could go further and have multiple versions of eub that supported different levels of functionality (eub-nobuiltins, eub-ioonly, eub-cfunconly, eub-ioandcfunc, ..., eub-hasitall) and have bind.ex attempt to determine which version of eub is the best fit for the code being bound.
That's a major piece of work (touching eub's front end(s) and backend(s) and possibly the runtime library, the interpreter, and the translator) and we'd still probably have questions such as "I just used prepend() and my bound executable grew by 1Mb! How do I get to use prepend() but keep the file smaller?" I'm not sure this approach would be worth the effort.
We could provide the backend linked as a shared library. The interpreter and backend runner would then be able to share the same backend at that point. Obviously, this makes it more difficult to share a bound executable, but it would be a lot smaller.
Well, not if you include having to ship the backend shared library as well. And we'd have to worry about making the backend library backwards compatible with holder versions of itself, or require that all bound programs include the right version of the library that they need (which sort of defeats the purpose of making it shared in the first place).
4. Re: Size of bound files
- Posted by ghaberek (admin) Nov 30, 2011
- 1165 views
Snarky answer: Use the translator. (I get a 5MB bound file, and a 500KB translated file.)
Matt
I don't think it's snarky; I completely agree. For easy distribution of Euphoria programs, one cannot beat the translator. I'd also like to see an option where I can easily translate libraries separately into DLLs (e.g. Win32Lib) that dynamically link into my translated executable.
-Greg
5. Re: Size of bound files
- Posted by ChrisB (moderator) Nov 30, 2011
- 1115 views
Hi
It's ok, its not a snarky answer, and I've just bound it and got 376945 bytes (1/10 the size). But that wasn't my point.
I appreciate the difficulties, and was just wondering if there was a way of stripping out unused portions of the translator during the binding process. As I also said its low priority, but figured it was one step towards getting back to the size of bound executables we used to have.
Cheers
Chris
6. Re: Size of bound files
- Posted by jimcbrown (admin) Nov 30, 2011
- 1118 views
I appreciate the difficulties, and was just wondering if there was a way of stripping out unused portions of the translator during the binding process. As I also said its low priority, but figured it was one step towards getting back to the size of bound executables we used to have.
Cheers
Chris
As Matt said, it's something that's fairly difficult to do.
I'm open to suggestions (and even better, functioning examples). If there's a good way to achieve this then I'm all for it.
But .. until someone comes up with an idea and shares it, I expect very little progress on this issue. Not because I'm against the idea itself, but simply because it's hard.
7. Re: Size of bound files
- Posted by Vinoba Nov 30, 2011
- 1084 views
My simple suggestion and reply is that 3-4mb "bound" file is no big deal. What really matters is speed of execution and to a small extent speed of compilation of your bound file. Leave the rest to Intel to bring out even faster and more dense Terrabyte memory chips and faster CPUs with lots of on board memory (on the chip) and even more on the main board!
I am saying the above having graduated over the years from a 16 KB (KILOBYTE - no mistake here) computer to today's monsters which I love enormously.
And if anybody talks of Windows 98 machine with a 500MB hard drive and 16 mb main memory, tell him to buy a time machine and fly back in time - Ah wait, - a time machine would cost more than a used Windows XP computer with 2GB main memory and 30 GB hard drive - maybe around $80 if he looks hard enough.