From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MUS8m-000643-GT for mharc-grub-devel@gnu.org; Fri, 24 Jul 2009 17:17:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MUS8k-00062E-Ge for grub-devel@gnu.org; Fri, 24 Jul 2009 17:17:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MUS8f-0005z6-Vy for grub-devel@gnu.org; Fri, 24 Jul 2009 17:17:18 -0400 Received: from [199.232.76.173] (port=54332 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUS8f-0005z3-Ly for grub-devel@gnu.org; Fri, 24 Jul 2009 17:17:13 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:56752) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MUS8f-0002OF-5I for grub-devel@gnu.org; Fri, 24 Jul 2009 17:17:13 -0400 Received: from [85.180.4.132] (e180004132.adsl.alicedsl.de [85.180.4.132]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1MUS8e07tF-000opi; Fri, 24 Jul 2009 23:17:12 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: References: <20090208134953.00aef328@gibibit.com> <20090209141116.GD4394@thorin> <20090209082425.3d5ff676@gibibit.com> <1244716115.3552.0.camel@fz.local> Content-Type: text/plain; charset="UTF-8" Date: Fri, 24 Jul 2009 23:17:59 +0200 Message-Id: <1248470279.3510.80.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.27.4 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX1/eLurrljsb4gM/Z4OqLoGZF51ZkiOHP3dLbxV BXY47W4z3VRqOhJuvAJF/BH85OSiqcfpHtYsYVy3ySouPuoLul dw5IyF9DPd+io9hi8jw0FwfM0dn7u6n 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: Fri, 24 Jul 2009 21:17:19 -0000 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-numbere= d Unicode > >> > > characters are used=E2=80=94speeds up retrieving a glyph for a par= ticular > >> > > Unicode character. This makes text rendering in general much fast= er. > >> > > > >> > > 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. > >> > > > >> > > Fonts created by 'grub-mkfont' already satisfy this requirement. = Fonts > >> > > created by my old Java 'fonttool' do not, and cannot be used any l= onger. > >> > > > >> > > The font loader verifies that fonts fulfill the character ordering > >> > > requirement, refusing to load invalid fonts, but the primary chang= e is > >> > > in the 'find_glyph()' function, which now uses a binary search rat= her > >> > > than a linear search to find the glyph. > >> > > >> > Very nice! > >> > > >> > With this patch, how does retrieving glyphs from the complete unicod= e font > >> > compare to retrieving glyphs (without the patch) from the ascii asci= i 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 > >> 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. > >> > > > > 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 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 Felix Zielcke