From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MEhWZ-0006jL-77 for mharc-grub-devel@gnu.org; Thu, 11 Jun 2009 06:28:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEhWV-0006fY-Qa for grub-devel@gnu.org; Thu, 11 Jun 2009 06:28:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEhWR-0006VR-1A for grub-devel@gnu.org; Thu, 11 Jun 2009 06:28:43 -0400 Received: from [199.232.76.173] (port=51744 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEhWQ-0006VB-OF for grub-devel@gnu.org; Thu, 11 Jun 2009 06:28:38 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:63895) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEhWP-0000DL-U2 for grub-devel@gnu.org; Thu, 11 Jun 2009 06:28:38 -0400 Received: from [85.180.28.41] (e180028041.adsl.alicedsl.de [85.180.28.41]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MKsym-1MEhWO1GdY-000cyr; Thu, 11 Jun 2009 12:28:36 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <20090209082425.3d5ff676@gibibit.com> References: <20090208134953.00aef328@gibibit.com> <20090209141116.GD4394@thorin> <20090209082425.3d5ff676@gibibit.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 11 Jun 2009 12:28:35 +0200 Message-Id: <1244716115.3552.0.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX1+6CAr+vBCNZ24otRI2os8Sl5xqtknnVpO3xRI Whs2JuWQTsK3XMR0+vjDbZnuffc6aLgJ3rNirz6CMIkv3PXX9z 7yFVhTBpJnqjL3Q53+hOfY2fPs53/GB X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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: Thu, 11 Jun 2009 10:28:44 -0000 Am Montag, den 09.02.2009, 08:24 -0800 schrieb Colin D Bennett: > On Mon, 9 Feb 2009 15:11:16 +0100 > Robert Millan wrote: >=20 > > 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 U= nicode > > > characters are used=E2=80=94speeds up retrieving a glyph for a partic= ular > > > Unicode character. This makes text rendering in general much faster. > > >=20 > > > My text benchmark shows the new text rendering speed is somewhere fro= m > > > 2.6x to 31x of the previous speed. Basically, PFF2 font files are no= w > > > required to have the character index ordered in ascending order of co= de > > > point. > > >=20 > > > Fonts created by 'grub-mkfont' already satisfy this requirement. Fon= ts > > > created by my old Java 'fonttool' do not, and cannot be used any long= er. > > >=20 > > > The font loader verifies that fonts fulfill the character ordering > > > requirement, refusing to load invalid fonts, but the primary change i= s > > > 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 f= ont > > compare to retrieving glyphs (without the patch) from the ascii ascii o= ne? >=20 > 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. >=20 > Also, I ran the tests with both the 'ascii.pf2' and 'unicode.pf2' font > files generated by GRUB's Makefile. Here are the results: >=20 > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > 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] >=20 > [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. >=20 > [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. > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >=20 > 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. >=20 > (BTW, is there any way to run GRUB in a profiler? I'd like to know > where the graphics performance bottlenecks are.) >=20 > > Can we make unicode font the default now? >=20 > 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. >=20 Now that Vladimir finally commited this, should we make it now the default or not? --=20 Felix Zielcke