All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avoid expensive load of all fonts
@ 2008-07-04 13:55 Robert Millan
  2008-07-22 22:23 ` Robert Millan
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2008-07-04 13:55 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]


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

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)

[-- Attachment #2: speed_up_fonts.diff --]
[-- Type: text/x-diff, Size: 1814 bytes --]

2008-07-04  Robert Millan  <rmh@aybabtu.com>

	* 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}"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avoid expensive load of all fonts
  2008-07-04 13:55 [PATCH] avoid expensive load of all fonts Robert Millan
@ 2008-07-22 22:23 ` Robert Millan
  2008-07-22 22:49   ` Pavel Roskin
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Millan @ 2008-07-22 22:23 UTC (permalink / raw)
  To: grub-devel


Committed.

On Fri, Jul 04, 2008 at 03:55:01PM +0200, Robert Millan wrote:
> 
> 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
> 
> <GPLv2> I know my rights; I want my phone call!
> <DRM> What good is a phone call… if you are unable to speak?
> (as seen on /.)

> 2008-07-04  Robert Millan  <rmh@aybabtu.com>
> 
> 	* 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}"

> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avoid expensive load of all fonts
  2008-07-22 22:23 ` Robert Millan
@ 2008-07-22 22:49   ` Pavel Roskin
  2008-07-23  0:34     ` Robert Millan
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2008-07-22 22:49 UTC (permalink / raw)
  To: The development of GRUB 2

On Wed, 2008-07-23 at 00:23 +0200, Robert Millan wrote:
> > -	ruby $(srcdir)/util/unifont2pff.rb 0-127 $(UNIFONT_HEX) > $@
> > +	ruby $(srcdir)/util/unifont2pff.rb 0x0-0x7f $(UNICODE_ARROWS) $(UNICODE_LINES) $(UNIFONT_HEX) > $@

We should be able to use 0x20-0x7f.  I checked it and it seems to be OK.

-- 
Regards,
Pavel Roskin



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] avoid expensive load of all fonts
  2008-07-22 22:49   ` Pavel Roskin
@ 2008-07-23  0:34     ` Robert Millan
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Millan @ 2008-07-23  0:34 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Jul 22, 2008 at 06:49:08PM -0400, Pavel Roskin wrote:
> On Wed, 2008-07-23 at 00:23 +0200, Robert Millan wrote:
> > > -	ruby $(srcdir)/util/unifont2pff.rb 0-127 $(UNIFONT_HEX) > $@
> > > +	ruby $(srcdir)/util/unifont2pff.rb 0x0-0x7f $(UNICODE_ARROWS) $(UNICODE_LINES) $(UNIFONT_HEX) > $@
> 
> We should be able to use 0x20-0x7f.  I checked it and it seems to be OK.

Fine with me.  A few milliseconds less :-)

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-23  0:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-04 13:55 [PATCH] avoid expensive load of all fonts Robert Millan
2008-07-22 22:23 ` Robert Millan
2008-07-22 22:49   ` Pavel Roskin
2008-07-23  0:34     ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.