From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from smarthost01c.ixn.mail.zen.net.uk (smarthost01c.ixn.mail.zen.net.uk [212.23.1.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16053D59 for ; Thu, 23 Nov 2023 10:42:05 -0800 (PST) Received: from [82.71.22.80] (helo=pip.localnet) by smarthost01c.ixn.mail.zen.net.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r6EeK-001vyE-5u; Thu, 23 Nov 2023 18:42:04 +0000 From: Deri To: linux-man@vger.kernel.org, Alejandro Colomar Cc: groff@gnu.org Subject: Re: Optimize script for generating LinuxManBook.pdf Date: Thu, 23 Nov 2023 18:41:14 +0000 Message-ID: <2818350.Jt13fLt2Sg@pip> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-man@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-smarthost01c-IP: [82.71.22.80] Feedback-ID: 82.71.22.80 On Wednesday, 22 November 2023 14:58:56 GMT Alejandro Colomar wrote: > Hi Deri, > > I've optimized from 18.5 s down to 16.3 s the script, by splitting the > pipeline with this wrapper (and slightly reducing the perl script to > just print the pages to stdout). BTW, now it can be run from any > directory. And every step can be debugged by just introducing > > | tee /dev/tty \ > > wherever you want to debug. It's all pushed to master. > > The PDF is now printed to stdout, to avoid hard-coding file names. > > I still need to split a bit more and reduce the longest lines. How does > this script look to you? > > Cheers, > Alex :-) > Hi Alex, It looks fine, although you have to run the code in "prepare_linux_man_book.pl" twice (to avoid using a temporary file). If you are going to run preconv it is best to run it first - stops pic spitting out loads of warnings. You also dropped one stage in second pass, no pic in the pipeline. This may explain part of the speedup you observed. I don't know if any of your man pages require pic but they could in the future. The changes I would advise are:- --- a/scripts/LinuxManBook/build_linux_man_book.sh +++ b/scripts/LinuxManBook/build_linux_man_book.sh @@ -4,8 +4,8 @@ ( "$(dirname "$0")"/prepare_linux_man_book.pl "$1" \ - | pic \ | preconv \ + | pic \ | tbl \ | eqn -Tpdf \ | troff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 \ @@ -16,6 +16,7 @@ "$(dirname "$0")"/prepare_linux_man_book.pl "$1"; ) \ | preconv \ +| pic \ | tbl \ | eqn -Tpdf \ | ( Cheers Deri