|Perl Monk, Perl Meditation|
How much of Perl can be removed?by hacker (Priest)
|on Aug 13, 2002 at 13:23 UTC||Need Help??|
hacker has asked for the
wisdom of the Perl Monks concerning the following question:
Being a purist, minimalist and a pedant, it has come to my attention that bringing a Perl interpretor to a PDA with very constrained memory requirements might prove useful, if the power of that interpretor could be leveraged to handle things outside the "norm" of the tool.
I am/was one of the lead developers of the "Bootable Business Card", a business-card sized Linux distribution on a bootable CD that includes hundreds of tools, utilities, and other things on a compressed ISO image (leveraged with cloop, BusyBox, -Os at build-time, etc). In this space and memory-constrained environment, we had to use a script for init, instead of a binary, stripped the --help strings from many of the common binaries to reduce size, and so on. I'm very familiar with trying to pare down the unnecessary cruft.
So I pose this question.. when dealing with a device that has no built-in filesystem (a PalmOS©-based PDA device), how much of Perl can be removed? PalmOS handheld devices don't have a filesystem or "directory" structure, so the code in the interpretor that deals with those things could be removed (there is "Virtual File System" (VFS), but it's only a "pseudo" filesystem). This may change when OS5.1 and later versions come out with native filesystem support on ARM devices, but current devices and the newest OS5 release will not contain this functionality.
Palm devices likely won't be able to take advantage of most of the external modules (File::Copy or IO::Socket for example), so those hooks in the perl interpretor could be removed, as well as most of the documentation (perldoc, et al). Strings inside the binary itself could be removed as well. Someone who is running Perl on their Palm PDA device is probably familiar enough with perl to be able to use it without onboard documentation (or documentation could be stored in HTML and viewed on the Palm in another app such as Plucker).
Is it feasible to get the binary down to ~200k? 300k? I'm looking for other ways to shave down the size, remove the parts that aren't needed, and still retain the functionality that I require. I'm looking to create a resource library, PerlLib.prc that can be called from other applications directly, similar to the MathLib and SysZLib libraries commonly in use.