I am working on a font driver to implement this "preloading" functionality. 
Another optimisation that I can think of is only preprocessing a subset of the 
glyphs that are most used, to decrease load time and still offer performance 
benefits.

Will finish it ASAP and send benchmark reports.

Regards
Anurag


________________________________
From: Anurag Thakur <anurag105cse...@bpitindia.edu.in>
Sent: Saturday, August 5, 2023 5:46:53 PM
To: Anurag Thakur <anurag105cse...@bpitindia.edu.in>; Werner LEMBERG 
<w...@gnu.org>
Cc: freetype-devel@nongnu.org <freetype-devel@nongnu.org>; 
raph.lev...@gmail.com <raph.lev...@gmail.com>
Subject: RE: Progress update on alternative rendering engines project


I tested different variations of the benchmark, by changing iteration counts 
and it appears that as the number of iterations increase fontdue fares better 
against FreeType (`smooth`)



I have attached graphs for the benchmark results, green represents fontdue is 
faster and red represents FreeType is faster, and the radius of circle 
represents percentage difference.



And I stand corrected, even without SIMD, there are some cases where fontdue is 
faster (as demonstrated by the green circles in arm64 benchmarks).



I will try to port its approach to outline storage and send another round of 
benchmark results within a couple of days.



Notes:

X64 benchmark performed on a ryzen 5500u laptop (plugged in)

arm64 benchmark performed on a dimensity 920 5G android phone under termux 
(plugged in)

Used `taskset -c 0` to minimize variance



Regards

Anurag



From: freetype-devel-bounces+anurag105csec21=bpitindia.edu...@nongnu.org 
<freetype-devel-bounces+anurag105csec21=bpitindia.edu...@nongnu.org> On Behalf 
Of Anurag Thakur
Sent: Saturday, August 5, 2023 12:42 PM
To: Werner LEMBERG <w...@gnu.org>
Cc: freetype-devel@nongnu.org; raph.lev...@gmail.com
Subject: Re: Progress update on alternative rendering engines project



Added my benchmark program here:



https://gitlab.freedesktop.org/AdbhutDev/duetest



Usage:

Clone the repo, and execute "cargo build --release" under `duetest/`



The binary can be found under `target/release`



It needs the location of the font file as an argument.



> With 'FreeType' you mean the standard rasterizer in `src/smooth`,
right?



Yes, all these benchmarks were done with `smooth`. To be exact the project uses 
"freetype-rs" which itself seems to use "freetype-sys" which according to their 
GitHub uses FreeType 2.12.1, I couldn't find the function to print the library 
version in the binding so can't confirm.



> What exactly did you compare time-wise with FreeType's 'smooth'
render?



The original rust version.



I am now trying to run my port under this benchmark by modifying the 
freetype-sys create, will report my findings.



Also, I was running the benchmark with 500 iterations, however increasing the 
iteration count to 5000 seems to give fontdue an advantage.



Another caveat, it is currently only testing the lowercase English alphabet.



I am working on graphing my findings so that it's easier to draw conclusions.



Regards,
Anurag



________________________________

From: Werner LEMBERG <w...@gnu.org<mailto:w...@gnu.org>>
Sent: Saturday, August 5, 2023 9:57:06 am
To: Anurag Thakur 
<anurag105cse...@bpitindia.edu.in<mailto:anurag105cse...@bpitindia.edu.in>>
Cc: freetype-devel@nongnu.org<mailto:freetype-devel@nongnu.org> 
<freetype-devel@nongnu.org<mailto:freetype-devel@nongnu.org>>; 
raph.lev...@gmail.com<mailto:raph.lev...@gmail.com> 
<raph.lev...@gmail.com<mailto:raph.lev...@gmail.com>>
Subject: Re: Progress update on alternative rendering engines project



Hello Anurag,


> From what I understood, the main performance improvement that
> fontdue claims to have is that it stores the font outlines
> differently, i.e. it seems to perform the curve flattening at
> initial load and stores the outline in the form of "v_lines" and
> "m_lines", presumably indicating "vertical lines" and lines spanning
> "multiple pixels horizontally".
>
> While trying to implement and benchmark it, I realized I had made a
> mistake in my previous benchmarks : I did not disable hinting.
>
> Fontdue does not support hinting, while the default mode for
> FreeType seems to have hinting enabled, leading to a decrease in
> performance.  This was also an issue with the benchmark program used
> by fontdue.
>
> I created a small benchmark program and reran the benchmarks with
> hinting disabled, and as expected freetype was much faster with
> hinting disabled.  So much so that on arm64 where there is no SIMD
> in fontdue, FreeType is faster in every single case.

With 'FreeType' you mean the standard rasterizer in `src/smooth`,
right?

> Its only with SIMD optimizations that fontdue is faster in a small
> range of sizes.

Very interesting!  Raph, can you comment, please?  You can find
Anurag's comparison images at

  https://lists.nongnu.org/archive/html/freetype-devel/2023-08/msg00008.html

> I have also discovered some sort of regression with the `smooth`
> rasterizer using the font "Cascadia Code".  Its performance degrades
> rapidly when rendering that font.  A preliminary check indicates
> something to do with "overlap_spans", I will send the `perf` results
> as well ASAP.

Thanks in advance.

> While I am trying to investigate more thoroughly, the benchmarks at
> first glance seem to indicate that only the SIMD improvement is
> worth considering and the other claims of performance don't seem to
> work well.

What exactly did you compare time-wise with FreeType's 'smooth'
render?  The original Rust version of 'fontdue', or your conversion of
'fontdue' into a FreeType driver module written in C?

  https://gitlab.freedesktop.org/freetype/freetype/-/tree/gsoc-anurag-2023


    Werner


Reply via email to