From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LWZQJ-0007G5-4T for mharc-grub-devel@gnu.org; Mon, 09 Feb 2009 11:55:55 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWZQH-0007FU-Ua for grub-devel@gnu.org; Mon, 09 Feb 2009 11:55:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWZQF-0007Dz-8J for grub-devel@gnu.org; Mon, 09 Feb 2009 11:55:53 -0500 Received: from [199.232.76.173] (port=51682 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWZQF-0007Dp-3l for grub-devel@gnu.org; Mon, 09 Feb 2009 11:55:51 -0500 Received: from gateway07.websitewelcome.com ([69.41.247.30]:52689) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LWZ7I-0001Zd-Rj for grub-devel@gnu.org; Mon, 09 Feb 2009 11:36:19 -0500 Received: (qmail 3825 invoked from network); 9 Feb 2009 16:43:50 -0000 Received: from gator297.hostgator.com (74.53.228.114) by gateway07.websitewelcome.com with SMTP; 9 Feb 2009 16:43:50 -0000 Received: from [67.185.177.95] (port=56801 helo=localhost) by gator297.hostgator.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1LWYvs-0005se-9C; Mon, 09 Feb 2009 10:24:28 -0600 Date: Mon, 9 Feb 2009 08:24:25 -0800 From: Colin D Bennett To: The development of GRUB 2 Message-ID: <20090209082425.3d5ff676@gibibit.com> In-Reply-To: <20090209141116.GD4394@thorin> References: <20090208134953.00aef328@gibibit.com> <20090209141116.GD4394@thorin> X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/u.oCM8.JF+VPg3Dd=bzrGFF"; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator297.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gibibit.com X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: rmh@aybabtu.com Subject: Re: [PATCH] Faster text rendering by optimizing font glyph lookup 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: Mon, 09 Feb 2009 16:55:54 -0000 --Sig_/u.oCM8.JF+VPg3Dd=bzrGFF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 9 Feb 2009 15:11:16 +0100 Robert Millan wrote: > On Sun, Feb 08, 2009 at 01:49:53PM -0800, Colin D Bennett wrote: > > This patch greatly=E2=80=94*tremendously*, even, if higher-numbered Uni= code > > characters are used=E2=80=94speeds up retrieving a glyph for a particul= ar > > Unicode character. This makes text rendering in general much faster. > >=20 > > My text benchmark shows the new text rendering speed is somewhere from > > 2.6x to 31x of the previous speed. Basically, PFF2 font files are now > > required to have the character index ordered in ascending order of code > > point. > >=20 > > Fonts created by 'grub-mkfont' already satisfy this requirement. Fonts > > created by my old Java 'fonttool' do not, and cannot be used any longer. > >=20 > > The font loader verifies that fonts fulfill the character ordering > > requirement, refusing to load invalid fonts, but the primary change is > > in the 'find_glyph()' function, which now uses a binary search rather > > than a linear search to find the glyph. >=20 > Very nice! >=20 > With this patch, how does retrieving glyphs from the complete unicode font > compare to retrieving glyphs (without the patch) from the ascii ascii one? Here is the result of my benchmark with two kinds of text: (1) 104 characters of ASCII English text, and (2) 104 Unicode characters randomly selected from the characters in unifont, uniformly distributed over all 61050 characters in the font. Also, I ran the tests with both the 'ascii.pf2' and 'unicode.pf2' font files generated by GRUB's Makefile. Here are the results: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 9 February 2009 videotest bench, text rendering benchmark 640x480 resolution =20 ASCII Text Unicode Text Algorithm Unifont used (Chars/s) (Chars/s) --------------- ------------- ---------- ------------ Linear search ASCII Font 255113 12098 [1] Linear search Unicode Font 250874 23068 [2] Binary search ASCII Font 255746 96231 [1] Binary search Unicode Font 255113 194741 [2] [1] Note that using the ASCII font for Unicode text results in a performance hit because the grub_font_draw_string() function will use font fallback to search for the missing glyphs in another font. I had other fonts loaded while running the benchmark, so GRUB had to scan them for the missing characters. [2] These numbers, for full Unicode text with the full unifont, show the improvement in worst-case performance when using the binary search versus linear search. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Note that most of the time is now spent actually rendering the bitmaps on screen (instead of retrieving glyphs from the font), which actually takes longer for the Unicode text because many of the glyphs are wider than the English ASCII characters. (BTW, is there any way to run GRUB in a profiler? I'd like to know where the graphics performance bottlenecks are.) > Can we make unicode font the default now? I think so. Using the full Unicode font does not seem to have a significant effect on rendering speed now. I will commit the patch if it looks OK to you. Regards, Colin --Sig_/u.oCM8.JF+VPg3Dd=bzrGFF Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkmQWLwACgkQokx8fzcGbYf9rwCePyD3hCY/BXS4DbhDcvyLNzc3 wPQAoI17z5cMXpo5SlRKIkjHczU8XPEb =FV19 -----END PGP SIGNATURE----- --Sig_/u.oCM8.JF+VPg3Dd=bzrGFF--