Bug#696465: /etc/bash_completion.d/grub wastes 35 ms running sed "s, x, x, " 12 times

Colin Watson cjwatson at debian.org
Fri Dec 28 06:59:16 UTC 2012


tags 696465 fixed-upstream
thanks

On Fri, Dec 21, 2012 at 02:29:53AM -0500, Anders Kaseorg wrote:
> After fixing the worst offender (#695811), I found that about 15% of my 
> bash’s startup time is spent in /etc/bash_completion.d/grub forking and 
> execing sed "s,x,x," 12 times.  The patch below reduces the time it takes 
> to source /etc/bash_completion.d/grub from 42 ms to 7 ms, saving 35 ms on 
> startup of every interactive bash.  This stuff adds up!
> 
> This sed call comes from @program_transform_name@; for Debian we can 
> safely assume that functionality is not used.  Perhaps upstream should 
> consider refactoring to perform this transformation at build time.

I've done the refactoring you suggest upstream.

2012-12-28  Colin Watson  <cjwatson at ubuntu.com>

	Apply program name transformations at build-time rather than at
	run-time.  Fixes Debian bug #696465.

	* acinclude.m4 (grub_TRANSFORM): New macro.
	* configure.ac: Create output variables with transformed names for
	most programs.
	* util/bash-completion.d/grub-completion.bash.in: Use
	pre-transformed variables for program names.
	* util/grub-install.in: Likewise.
	* util/grub-kbdcomp.in: Likewise.
	* util/grub-mkconfig.in: Likewise.
	* util/grub-mkconfig_lib.in: Likewise.
	* util/grub-mknetdir.in: Likewise.
	* util/grub-mkrescue.in: Likewise.
	* util/grub-mkstandalone.in: Likewise.
	* util/grub-reboot.in: Likewise.
	* util/grub-set-default.in: Likewise.
	* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
	* tests/util/grub-shell-tester.in: Remove unused assignment.
	* tests/util/grub-shell.in: Likewise.
	* util/grub.d/00_header.in: Likewise.

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list