From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MUzmG-0007BP-Lx for mharc-grub-devel@gnu.org; Sun, 26 Jul 2009 05:12:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MUzmF-0007AT-Dh for grub-devel@gnu.org; Sun, 26 Jul 2009 05:12:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MUzmA-00075S-4K for grub-devel@gnu.org; Sun, 26 Jul 2009 05:12:18 -0400 Received: from [199.232.76.173] (port=54924 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUzm9-00075H-V7 for grub-devel@gnu.org; Sun, 26 Jul 2009 05:12:14 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:53267) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MUzm9-0000bE-B1 for grub-devel@gnu.org; Sun, 26 Jul 2009 05:12:13 -0400 Received: from [85.180.49.97] (e180049097.adsl.alicedsl.de [85.180.49.97]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MKv1o-1MUzm81298-0008Yp; Sun, 26 Jul 2009 11:12:12 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <1248470279.3510.80.camel@fz.local> References: <20090208134953.00aef328@gibibit.com> <20090209141116.GD4394@thorin> <20090209082425.3d5ff676@gibibit.com> <1244716115.3552.0.camel@fz.local> <1248470279.3510.80.camel@fz.local> Content-Type: text/plain; charset="UTF-8" Date: Sun, 26 Jul 2009 11:13:01 +0200 Message-Id: <1248599581.25072.7.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.27.4 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX1/06c+fXKWOU90RZqbfy4WxBrfIX4E/T7abDP0 tsP62o/bUkSzQAJmyPbd6jdwUY5C6qiz93nQ8nGe8zP/19zP4g WBX8skXONYxe3jeI6MfmA== 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: Sun, 26 Jul 2009 09:12:19 -0000 Am Freitag, den 24.07.2009, 23:17 +0200 schrieb Felix Zielcke: > Am Donnerstag, den 11.06.2009, 23:31 +0200 schrieb Vladimir 'phcoder' > Serbinenko: > > On Thu, Jun 11, 2009 at 12:28 PM, Felix Zielcke wrote= : > > > 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: > > >> > > >> > On Sun, Feb 08, 2009 at 01:49:53PM -0800, Colin D Bennett wrote: > > >> > > This patch greatly=E2=80=94*tremendously*, even, if higher-numbe= red Unicode > > >> > > characters are used=E2=80=94speeds up retrieving a glyph for a p= articular > > >> > > Unicode character. This makes text rendering in general much fa= ster. > > >> > > > > >> > > My text benchmark shows the new text rendering speed is somewher= e from > > >> > > 2.6x to 31x of the previous speed. Basically, PFF2 font files a= re now > > >> > > required to have the character index ordered in ascending order = of code > > >> > > point. > > >> > > > > >> > > Fonts created by 'grub-mkfont' already satisfy this requirement.= Fonts > > >> > > created by my old Java 'fonttool' do not, and cannot be used any= longer. > > >> > > > > >> > > The font loader verifies that fonts fulfill the character orderi= ng > > >> > > requirement, refusing to load invalid fonts, but the primary cha= nge is > > >> > > in the 'find_glyph()' function, which now uses a binary search r= ather > > >> > > than a linear search to find the glyph. > > >> > > > >> > Very nice! > > >> > > > >> > With this patch, how does retrieving glyphs from the complete unic= ode font > > >> > compare to retrieving glyphs (without the patch) from the ascii as= cii 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' fo= nt > > >> files generated by GRUB's Makefile. Here are the results: > > >> > > >> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '' > > >> 9 February 2009 videotest bench, text rendering > > >> benchmark 640x480 resolution > > >> 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 wil= l > > >> 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 bitma= ps > > >> on screen (instead of retrieving glyphs from the font), which actual= ly > > >> takes longer for the Unicode text because many of the glyphs are wid= er > > >> 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. > > >> > > > > > > Now that Vladimir finally commited this, should we make it now the > > > default or not? > > I think we can make unicode fonts default now. Don't get too > > overexcited though: we still lack ligatures. I don't know if composing > > accents work and no bidi.But this subset is already enough to support > > all European languages, Chinese, Korean and Japanese as long > > characters are precomposed >=20 > So if there still won't come up objections against this, then I'll do > the change, then at least an Ubuntu bug report can be closed. >=20 Ah just read now the comment in grub-mkconfig_lib.in, which complains about loading speed not rendering. In qemu there's a very small delay in loading unicode.pf2 ascii.pf2 loads instantly. But I think that's acceptable or not? --=20 Felix Zielcke Proud Debian Maintainer