Skip to content

Use fnv hashing in rasterizer

Jeremy Soller requested to merge alexheretic:fnv-rasterize into master

Created by: alexheretic

Now we have reference test and benchmarks for rasterization its only natural to start optimising. Actually I'm resisting the urge to dive too deep, but when I saw the local hash map with small keys I thought to myself: I wonder if fnv hashing would be worth it here?

It seems that it is. A 9-65% draw speedup that also helps the gpu_cache population test (which is heavily rasterizing, unlike the other gpu_cache benchmarks).

 name                                                       control ns/iter  change ns/iter  diff ns/iter   diff %  speedup 
 draw_big_biohazard                                         903,260          831,307              -71,953   -7.97%   x 1.09 
 draw_iota                                                  37,110           25,476               -11,634  -31.35%   x 1.46 
 draw_w                                                     10,053           6,093                 -3,960  -39.39%   x 1.65 
 gpu_cache::cache_bench_tests::bench_multi_font_population  12,274,577       9,844,106         -2,430,471  -19.80%   x 1.25 

I also added a open-sans 60px iota ΐ reference test & benchmark to give us a "medium" sized glyph reference.

I actually expect we can rasterize without any hashing, I wonder how fast we can get drawing?

Merge request reports