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.

-- 
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to