Commit Graph

13211 Commits

Author SHA1 Message Date
Behdad Esfahbod 5248b2567b [ot-font/h-advance] Adjust varStore cache condition
This gives best performance for short strings, now that we have a h-advance cache as well.
The en-words benchmark in particular, now ot-font is faster than ft.

Second to last line is of interest:

Before:
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      29.8 ms         29.8 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.4 ms         30.4 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.5 ms         16.5 ms           42
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       18.0 ms         18.0 ms           39
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39

After:
behdad@Behdads-MacBook-Pro harfbuzz % ninja -Cbuild && build/perf/benchmark-shape --benchmark_filter=en-words
-----------------------------------------------------------------------------------------------------
Benchmark                                                           Time             CPU   Iterations
-----------------------------------------------------------------------------------------------------
BM_Shape/en-words.txt/Roboto-Regular.ttf/hb                      30.0 ms         30.0 ms           23
BM_Shape/en-words.txt/Roboto-Regular.ttf/ft                      30.3 ms         30.3 ms           23
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/hb           16.3 ms         16.3 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/ft           16.4 ms         16.4 ms           43
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/hb       17.6 ms         17.6 ms           40
BM_Shape/en-words.txt/SourceSerifVariable-Roman.ttf/var/ft       17.8 ms         17.8 ms           39
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 12fff976b6 [ot-var] Use atomic int for cached-serial 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 0919eaa6e8 [ot-font] Remove lock around cache
Not needed.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 3548b6025f [ot-font] Cache h-advances for variable fonts 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 39a07bf3eb [ot-font] Rename cache to varStore_cache 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 970e03ecae [ot-font] Add a hb_ot_font_t struct 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 80c49933c6 [hb-ft] Adjust serial signature 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 56e0ff9ea1 [ft] If hb_font changed, update FT_Face
Fixes https://github.com/harfbuzz/harfbuzz/issues/2270

Rather untested.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod d0de389de8 [font] Fix test 2022-05-26 05:02:50 -06:00
Behdad Esfahbod a2015cd300 [font] Add a separate serial_coords 2022-05-26 05:02:50 -06:00
Behdad Esfahbod 8629df188a [ft] Discard advance cache if font changed
Uses newly added font serial API.

Part of https://github.com/harfbuzz/harfbuzz/issues/2270

But doesn't set new coords on the FT_Face. That's a lot more
work :(.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 48db1c9583 [font] Add serial API
New API:
+ hb_font_get_serial()
+ hb_font_changed()

Fixes https://github.com/harfbuzz/harfbuzz/issues/2426

Unused internally as of now.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 0fe1869228 [benchmark-set] Pause timing around set copy initialization 2022-05-26 05:02:23 -06:00
Behdad Esfahbod ce5435a862 [benchmark-set] Remove use of rand() inside benchmark 2022-05-26 05:02:13 -06:00
Behdad Esfahbod efa2a5796e [map] Add hb_map_copy()
New API:
+ hb_map_copy()
2022-05-26 05:01:57 -06:00
Behdad Esfahbod 3b28cff9c0 [cff1] Fix null dereference on memory alloc failure 2022-05-26 04:42:17 -06:00
Behdad Esfahbod 8df9aba997 Actually try to fix null-size undefined behavior
Related to:
https://github.com/harfbuzz/harfbuzz/pull/2067
https://bugzilla.mozilla.org/show_bug.cgi?id=1577584
2022-05-26 03:59:21 -06:00
Garret Rieger e00c7358a0 [subset] special case table presence check for hb_face_create_from_tables faces. 2022-05-25 22:39:00 +00:00
Garret Rieger 6a149a09e7 [subset] fix use of lazy static constructor. 2022-05-25 22:22:35 +00:00
Garret Rieger d4c7939eb7 [subset] use a list of known tables instead of handled tables. 2022-05-25 22:11:32 +00:00
Garret Rieger 3472f73b79 [subset] also include no subset tables when guessing which tables are present. 2022-05-25 21:52:48 +00:00
Garret Rieger 9564d98739 [subset] fix subsetting of faces created via hb_face_create_for_tables.
Fixes #3609.
2022-05-25 21:16:37 +00:00
Behdad Esfahbod 6010feeeb5 [varStore] Rename variable as per review
https://github.com/harfbuzz/harfbuzz/pull/3605
2022-05-24 09:01:02 -06:00
Khaled Hosny 89939c9cc3 [ci] Fix fedora-valgrind job
Fedora 33 is EOL since 2021-11-30, try the latest Fedora release (36).
2022-05-24 03:50:59 +02:00
Behdad Esfahbod 8a7cfe1787 [perf/benchmark-shape] Test ft font backend as well 2022-05-23 14:36:06 -06:00
Behdad Esfahbod d473397831
Merge pull request #3605 from harfbuzz/cache-varstore
Cache varstore
https://github.com/harfbuzz/harfbuzz/pull/3605
2022-05-23 12:24:38 -06:00
Behdad Esfahbod 3eb7eff487 Remove varstore cache use if HB_NO_VAR 2022-05-21 15:25:53 -06:00
Behdad Esfahbod 099482a37a [ot-font] Cache v_advance varstore as well 2022-05-21 15:24:23 -06:00
Behdad Esfahbod d9acc045f1 [VarStore] Sprinkle cache_t type around
It's available so no need to use void*.
2022-05-21 15:12:14 -06:00
Behdad Esfahbod da38312e42 [VarStore] Pepper cache with likely() 2022-05-21 15:12:14 -06:00
Behdad Esfahbod cf8f00e354 [VarStore] Don't use NAN
Is faster.

With this, I'm seeing 25 to 28% speedup in glyph_h_advances benchmark
of benchmark-font for var/hb tests.
2022-05-21 15:12:14 -06:00
Behdad Esfahbod 5336ba70f6 [HVAR] Cache VarStore region scalars 2022-05-21 15:12:14 -06:00
Behdad Esfahbod 880f50f7e4 Refactor varstore cache 2022-05-21 15:12:14 -06:00
Behdad Esfahbod f2a2fb91a3 [GPOS] Cache VarStore region scalars 2022-05-21 15:12:14 -06:00
Behdad Esfahbod 5fbc70c59b [VarStore] Add cache API 2022-05-21 15:12:14 -06:00
Behdad Esfahbod e1f4445dff [benchmark-shape] Allow taking multiple tests from cmdline 2022-05-21 15:11:53 -06:00
Behdad Esfahbod 1bf2d5f885 [perf/benchmark-shape] Allow taking text-file/font-file args from cmdline 2022-05-21 14:44:00 -06:00
Behdad Esfahbod 852a8f04eb [perf/benchmark-font] Allow benchmarking fonts specified on cmdline 2022-05-21 14:43:49 -06:00
Behdad Esfahbod 05e82aa12e [ft] Add missing lock to kerning function 2022-05-20 17:36:59 -06:00
Behdad Esfahbod da4b6f1527 [benchmark-shape] Add variable fonts 2022-05-20 17:21:20 -06:00
Behdad Esfahbod 4ea2725704 [set/map] Expose hash API publicly
New API:
+ hb_set_hash()
+ hb_map_hash()
2022-05-20 13:19:48 -06:00
Behdad Esfahbod 2e186d9f24 [buffer] Improve hash function of segment_properties_t 2022-05-20 13:19:48 -06:00
Khaled Hosny aee123fc83 4.3.0 2022-05-20 21:07:25 +02:00
Behdad Esfahbod 975a5f9194 [array] Use hb_memcmp instead of memcmp
Fixes ubsan error.
2022-05-20 12:34:49 -06:00
Behdad Esfahbod 55804e8d68 [hb-ft] Minor rearrange of struct members
To make clear what members the lock protects.
2022-05-20 11:40:44 -06:00
Garret Rieger 4e11da054d [repacker] update repacker test golden file.
Changed due to removal of Kahn sorting.
2022-05-20 09:41:18 -06:00
Garret Rieger cbf8f44c9b [subset-perf] swap instead of copying vertice's when reordering during sort. 2022-05-20 09:41:18 -06:00
Garret Rieger b32ca2a292 [subset-perf] remove sort_kahn from repacker.
Without an optimized FIFO queue implementation it's nearly as slow as the now optimized sort_shortest_distance.
2022-05-20 09:41:18 -06:00
Behdad Esfahbod 4266cf3be2 [array] Specialize operator== for bytes_t and ubytes_t 2022-05-19 18:16:54 -06:00
Behdad Esfahbod 6eaa22e9d7 [serialize] Reduce link_t size from 16 to 12 2022-05-19 18:16:54 -06:00