* build initramfs: logging is slow
@ 2011-09-06 16:55 John Reiser
0 siblings, 0 replies; only message in thread
From: John Reiser @ 2011-09-06 16:55 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Commenting out this line from inst_simple:
ddebug "Installing $_src"
saves me about 10% real time (not counting final gzip) in build initramfs.
The low-level culprit is the extra _process_ [fork or clone] for $(_lvl2char ...) in:
----- dracut-logger
_do_dlog() {
[ -z "$maxloglvl" ] && return 0
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0 ### SLOW!
[ $lvl -le $maxloglvl ] || return 0
-----
Instead, the level translation should be done using an indexed array
(after an arithmetic check for index-out-of-range.)
Even better, the level comparison should be hoisted into the definition
of ddebug and dtrace, such as:
-----
ddebug() {
[ 5 -le $maxloglvl ] || return 0
set +x
dlog 5 "$@"
}
-----
If bash could conditionally re-define a function, then dlog_init might:
[ 5 -le $maxloglvl ] || eval "function ddebug() {}"
but that did not work for me.
--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-06 16:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06 16:55 build initramfs: logging is slow John Reiser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox