Re: better init.d/* : who carres ?
* Henrique de Moraes Holschuh [Thu, Aug 25 2005, 12:17:56PM]:
> Well, as long as you don't start using stuff that breaks often, or that
> loads a ton of crap dynamically, or (even worse) is in /usr instead of /bin
> or /sbin...
> Note that using dash is probably MUCH faster than perl. I don't know about
Well, I made some tests and can proof your claim. I have just tried a
simple version of the skeleton script with /bin/true as the daemon, a
simple config file to be read and optionaly a grep call in the script.
The perl version was a straight-forward port of the script with internal
grep method. Shell compatible config file reader was stolen from apt-cacher.
Tests run with a loop like:
time for x in `seq 1000` ; do perl skeleton.pl start ; perl skeleton.pl stop; done
The results reflected my expectations, speed order:
dash < ... < perl < zsh < bash;
Perl is a lot faster than what some perl hatters try to make us believe.
With external program calls, everything became really slow while usage
of the internal Perl implementation demonstraged its advantage.
perl < ... < dash < ... < zsh < bash
Conclusion: usage of many (even simple) external programs is evil, though
it may improve readability for "some people". Replacing setting /bin/sh
link to dash instead of bash and having more than 100 init scripts I can
assume the whole boot would be 3s faster (1900Mhz box).
Personaly, I would write all init scripts in Perl but unfortunately
compatibility considerations force us to do things that suck.
with external program (grep in the defaults file):
more external programs (grep ... | cut ... | wc ...):
Perl: (equivalent internal code)
<youam> nach duesseldorf zu freenet schaffe ich in einer verbindung auch
~5mb/s, ansonsten nur ziehend z.b. ftp.de.debian.org (dresden) ~4mb/s
<Zomb> unglaublich... die BandbreitensÃ¤ue
<youam> Zomb: hey, _du_ schickst doch für jeden einzelnen umlaut zwei byte über