FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-28-2010, 03:10 AM
Victor Lowther
 
Default Bashification of initscripts for moderate speedup

I have spent some time over the last month or so rewriting the Arch
initscripts in idiomatic bash -- since they rely on bash-specific
features, trying to keep them fairly POSIX is rather a waste of time and
a net performance loss -- using bash-style conditionals is about 30%
faster when nothing needs to be touched on the filesystem and about 200%
easier to read, and you can use bash regexps in place of most trivial
uses of sed, grep, and awk when mangling parameters or variables -- the
fewer short-lived processes we fork the better.

You can browse changes I have made in the git repo @
http://git.fnordovax.org/arch-initscripts/log/?h=bashification and you
can checkout my changes to play around with from
git://fnordovax.org/~victor/arch-initscripts

There is a gigantic whitespace fixup patch at the end, all it does is
fix all the whitespace errors I introduced while hacking and reformat
everything to a consistent indentation style (emacs shell-script mode,
if you are interested).

I have tested these changes on a VM and on my local laptop. I inlcuded
a PKGBUILD that will build an initscripts-git package, but be sure to
backup and restore your rc.*local, inittab, and rc.conf files because
they will get nuked the first time you install it.

Questions, comments, flames, etc. welcome. I can also spam the list with
patches if y'all really want.
--
Victor Lowther
LPIC2 UCP RHCE
 
Old 06-28-2010, 12:42 PM
Caleb Cushing
 
Default Bashification of initscripts for moderate speedup

On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
<victor.lowther@gmail.com> wrote:
> Questions, comments, flames, etc. welcome.

why go this way instead of the other? (clarification why go deeper
into bash instead of trying to posix-ify the scripts)

--
Caleb Cushing

http://xenoterracide.blogspot.com
 
Old 06-28-2010, 01:04 PM
Dan McGee
 
Default Bashification of initscripts for moderate speedup

On Mon, Jun 28, 2010 at 7:42 AM, Caleb Cushing <xenoterracide@gmail.com> wrote:
> On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
> <victor.lowther@gmail.com> wrote:
>> Questions, comments, flames, etc. welcome.
>
> why go this way instead of the other? (clarification why go deeper
> into bash instead of trying to posix-ify the scripts)

Because we are never going to eliminate arrays from rc.conf.

-Dan
 
Old 06-28-2010, 01:35 PM
Victor Lowther
 
Default Bashification of initscripts for moderate speedup

On Jun 28, 2010, at 7:42 AM, Caleb Cushing <xenoterracide@gmail.com>
wrote:



On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
<victor.lowther@gmail.com> wrote:

Questions, comments, flames, etc. welcome.


why go this way instead of the other? (clarification why go deeper
into bash instead of trying to posix-ify the scripts)


Because arrays and associative arrays are very useful, using native
bash costructs instead of posix gives you a decent speed boost, and
the main source of slowdowns in the boot sequence is I/O based --
mounting filesystems and launching programs. Serious boot speed
optimization is a matter of optimizing I/O.




--
Caleb Cushing

http://xenoterracide.blogspot.com
 
Old 06-28-2010, 01:59 PM
Loui Chang
 
Default Bashification of initscripts for moderate speedup

On Mon 28 Jun 2010 08:04 -0500, Dan McGee wrote:
> On Mon, Jun 28, 2010 at 7:42 AM, Caleb Cushing <xenoterracide@gmail.com> wrote:
> > On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
> > <victor.lowther@gmail.com> wrote:
> >> Questions, comments, flames, etc. welcome.
> >
> > why go this way instead of the other? (clarification why go deeper
> > into bash instead of trying to posix-ify the scripts)
>
> Because we are never going to eliminate arrays from rc.conf.

Well, it may still be beneficial to some. The scripts could be used with
a different style rc.conf in other environments.
 
Old 06-28-2010, 02:13 PM
Victor Lowther
 
Default Bashification of initscripts for moderate speedup

On Jun 28, 2010, at 8:59 AM, Loui Chang <louipc.ist@gmail.com> wrote:


On Mon 28 Jun 2010 08:04 -0500, Dan McGee wrote:
On Mon, Jun 28, 2010 at 7:42 AM, Caleb Cushing <xenoterracide@gmail.com
> wrote:

On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
<victor.lowther@gmail.com> wrote:

Questions, comments, flames, etc. welcome.


why go this way instead of the other? (clarification why go deeper
into bash instead of trying to posix-ify the scripts)


Because we are never going to eliminate arrays from rc.conf.


Well, it may still be beneficial to some. The scripts could be used
with

a different style rc.conf in other environments.


Then it will not be Arch.
 
Old 06-28-2010, 02:49 PM
Loui Chang
 
Default Bashification of initscripts for moderate speedup

On Mon 28 Jun 2010 09:13 -0500, Victor Lowther wrote:
> On Jun 28, 2010, at 8:59 AM, Loui Chang <louipc.ist@gmail.com> wrote:
>
> >On Mon 28 Jun 2010 08:04 -0500, Dan McGee wrote:
> >>On Mon, Jun 28, 2010 at 7:42 AM, Caleb Cushing
> >><xenoterracide@gmail.com> wrote:
> >>>On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
> >>><victor.lowther@gmail.com> wrote:
> >>>>Questions, comments, flames, etc. welcome.
> >>>
> >>>why go this way instead of the other? (clarification why go deeper
> >>>into bash instead of trying to posix-ify the scripts)
> >>
> >>Because we are never going to eliminate arrays from rc.conf.
> >
> >Well, it may still be beneficial to some. The scripts could be used
> >with a different style rc.conf in other environments.
>
> Then it will not be Arch.

Depends on what you define as Arch.
I've heard that Arch is what you make of it. Hehe.
I don't know if you could disqualify it from a difference of one file.
 
Old 06-28-2010, 03:03 PM
Victor Lowther
 
Default Bashification of initscripts for moderate speedup

On Jun 28, 2010, at 9:49 AM, Loui Chang <louipc.ist@gmail.com> wrote:


On Mon 28 Jun 2010 09:13 -0500, Victor Lowther wrote:

On Jun 28, 2010, at 8:59 AM, Loui Chang <louipc.ist@gmail.com> wrote:


On Mon 28 Jun 2010 08:04 -0500, Dan McGee wrote:

On Mon, Jun 28, 2010 at 7:42 AM, Caleb Cushing
<xenoterracide@gmail.com> wrote:

On Sun, Jun 27, 2010 at 11:10 PM, Victor Lowther
<victor.lowther@gmail.com> wrote:

Questions, comments, flames, etc. welcome.


why go this way instead of the other? (clarification why go deeper
into bash instead of trying to posix-ify the scripts)


Because we are never going to eliminate arrays from rc.conf.


Well, it may still be beneficial to some. The scripts could be used
with a different style rc.conf in other environments.


Then it will not be Arch.


Depends on what you define as Arch.
I've heard that Arch is what you make of it. Hehe.
I don't know if you could disqualify it from a difference of one file.


For me, part of it is that bash is used pretty ubiquitously as the
configuration and scripting language of choice. Changing that to posix
sh in one of the main config files would be a big shift.
 
Old 06-28-2010, 03:55 PM
Lukáš Jirkovský
 
Default Bashification of initscripts for moderate speedup

Actually I see the point of doing this. Arch is a modern distribution
with the newest software around so why stuck with shell constructs
which are probably dozens of years old?

Lukas
 
Old 06-28-2010, 04:27 PM
Caleb Cushing
 
Default Bashification of initscripts for moderate speedup

On Mon, Jun 28, 2010 at 11:03 AM, Victor Lowther
<victor.lowther@gmail.com> wrote:
> For me, part of it is that bash is used pretty ubiquitously as the
> configuration and scripting language of choice. Changing that to posix sh in
> one of the main config files would be a big shift.

there seems to be a shift to dash as the main system shell in some
distro's these days... and as openrc show's it's possible to do things
similar to how arch does it (and gentoo used to) without bash.

--
Caleb Cushing

http://xenoterracide.blogspot.com
 

Thread Tools




All times are GMT. The time now is 04:35 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org