From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KEllM-0007qV-CK for mharc-grub-devel@gnu.org; Fri, 04 Jul 2008 09:55:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KEllI-0007pr-VR for grub-devel@gnu.org; Fri, 04 Jul 2008 09:55:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KEllH-0007pF-0v for grub-devel@gnu.org; Fri, 04 Jul 2008 09:55:44 -0400 Received: from [199.232.76.173] (port=45485 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KEllG-0007pC-TW for grub-devel@gnu.org; Fri, 04 Jul 2008 09:55:42 -0400 Received: from aybabtu.com ([69.60.117.155]:41397) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KEllG-0006BC-DR for grub-devel@gnu.org; Fri, 04 Jul 2008 09:55:42 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KElhB-0001Gx-Vo for grub-devel@gnu.org; Fri, 04 Jul 2008 15:51:30 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KElkb-0000gh-FH for grub-devel@gnu.org; Fri, 04 Jul 2008 15:55:01 +0200 Date: Fri, 4 Jul 2008 15:55:01 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080704135501.GA2612@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] avoid expensive load of all fonts X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 13:55:45 -0000 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit This makes update-grub avoid expensive load of complete font files and instead rely on ascii.pff when it is available. In qemu, it brings startup time roughly from 25s to 1s. -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.) --pWyiEgJYm5f9v55/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="speed_up_fonts.diff" 2008-07-04 Robert Millan * Makefile.in (UNICODE_ARROWS, UNICODE_LINES): New variables (they define the codes for arrows and lines used for the menu). (ascii.pff): Generate fonts for $(UNICODE_ARROWS) and $(UNICODE_LINES) as well. * util/update-grub_lib.in (font_path): Prefer ascii.pff over complete fonts, because the latter are too slow. Index: Makefile.in =================================================================== --- Makefile.in (revision 1691) +++ Makefile.in (working copy) @@ -142,11 +142,16 @@ ifeq (, $(UNIFONT_HEX)) else pkgdata_DATA += unicode.pff ascii.pff + +# Arrows and lines are needed to draw the menu, so we always include them +UNICODE_ARROWS=0x2190-0x2193 +UNICODE_LINES=0x2501-0x251B + unicode.pff: $(UNIFONT_HEX) ruby $(srcdir)/util/unifont2pff.rb $(UNIFONT_HEX) > $@ ascii.pff: $(UNIFONT_HEX) - ruby $(srcdir)/util/unifont2pff.rb 0-127 $(UNIFONT_HEX) > $@ + ruby $(srcdir)/util/unifont2pff.rb 0x0-0x7f $(UNICODE_ARROWS) $(UNICODE_LINES) $(UNIFONT_HEX) > $@ endif all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(MKFILES) Index: util/update-grub_lib.in =================================================================== --- util/update-grub_lib.in (revision 1691) +++ util/update-grub_lib.in (working copy) @@ -131,8 +131,9 @@ font_path () { for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do - # Prefer complete fonts over incomplete ones. - for basename in unicode unifont ascii ; do + # FIXME: We prefer ascii because loading complete fonts is too slow (and + # we don't yet provide the gettext magic that would make unicode useful). + for basename in ascii unicode unifont ; do path="${dir}/${basename}.pff" if is_path_readable_by_grub ${path} > /dev/null ; then echo "${path}" --pWyiEgJYm5f9v55/--