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
05e82aa12e
[ft] Add missing lock to kerning function
2022-05-20 17:36:59 -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
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
Behdad Esfahbod
30ba9a39e2
[vector] Add emplacing push implementation
2022-05-19 18:16:48 -06:00
Garret Rieger
73b8360dcf
[subset] fix fuzzer found underflow when heap push fails.
...
Fixes https://oss-fuzz.com/testcase-detail/5148625505746944 .
2022-05-19 17:02:34 -06:00
Behdad Esfahbod
f1bf14ea89
Revert "[set] Cache hash value"
...
This reverts commit 44952bcc25
.
While we investivate https://github.com/harfbuzz/harfbuzz/issues/3599
2022-05-19 16:49:27 -06:00
Behdad Esfahbod
b4d1ec310c
[algs] Declare coerce() as constexpr
2022-05-19 16:06:21 -06:00
Behdad Esfahbod
2fdb7616f5
[map Further adjust hash function
2022-05-19 16:00:43 -06:00
Behdad Esfahbod
01fc90b68c
[map] Adjust hash function
2022-05-19 16:00:06 -06:00
Behdad Esfahbod
a47b0aebf5
[vector] Fix remove() implementation
...
test-vector under valgrind happy now.
2022-05-19 15:52:16 -06:00
Behdad Esfahbod
3bd755c32d
[test-vector] Test remove()
...
Currently buggy. Valgrind confirms.
2022-05-19 15:51:18 -06:00
Behdad Esfahbod
58f848daa8
[set/map] Adjust hash function return type
2022-05-19 15:43:19 -06:00
Behdad Esfahbod
6544fc284f
[vector] Add further copy implementation
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
c19f116952
[meta] Remove non-existing gcc4 trait implementation
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
679b900e9b
[meta] Fix gcc4 trait implementation
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
fb77f48ffd
[vector] Optimize vector copy
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
28b44ac46a
[set] Switch set copy to vector operator =
...
Slows it down currently.
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
37d3275dec
[test-vector] Enable disabled test
...
This seems to work already.
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
544ffb913e
[set] Adjust grow_vector condition
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
0623aa598b
[benchmark-set] Add benchmark for set copy
2022-05-19 15:43:15 -06:00
Behdad Esfahbod
44952bcc25
[set] Cache hash value
2022-05-19 14:02:48 -06:00
Behdad Esfahbod
844ac328e4
[set] Fix hb_set_t hash stability
2022-05-19 13:54:31 -06:00
Behdad Esfahbod
2d0b1248b2
[test-map] Test hb_set_t hash stability
...
Fails currently.
2022-05-19 13:53:53 -06:00
Behdad Esfahbod
561e02fefb
[map] Make hb_map_t hashable
2022-05-19 13:41:53 -06:00
Behdad Esfahbod
ad17699089
[map] Add is_equal() / towards making hb_map_t hashable
...
New API:
+ hb_map_is_equal()
2022-05-19 13:36:12 -06:00
Behdad Esfahbod
14a24d8e3f
[vector] Make hb_vector_t hashable
2022-05-19 13:04:06 -06:00
Behdad Esfahbod
124f9aeb9b
[set] Make hb_set_t hashable
2022-05-19 12:58:02 -06:00
Garret Rieger
3ab2c7935f
[subset-perf] Signficiantly speed up ClassDef*::subset.
...
Eliminates the usage of a glyph -> klass hash map and replaces it with a vector storing the mapping. This allows us to use the vector directly as the iterator driving the serialize. Approximately 1% speedup for Noto Nastaliq.
2022-05-19 12:37:28 -06:00
David Corbett
e3e685e5ee
[ot-tags] Fix `min_subtag_len` calculations
2022-05-18 18:30:01 -06:00
Garret Rieger
0b1c2ff96a
[subset-perf] Remove extra map lookup in ClassDef subset methods.
2022-05-18 18:25:36 -06:00
Garret Rieger
13ace77f1d
[subset-perf] Use glyph_map instead of set in ClassDefFormat.
2022-05-18 18:25:36 -06:00
Garret Rieger
adae2f2272
[subset-perf] Cache a glyph map for gsub.
...
This allows us in some cases to avoid using glyph_set_gsub as a filter.
2022-05-18 18:25:36 -06:00
Behdad Esfahbod
202e6c4699
[subset] Remove unnecessary test
2022-05-18 17:12:43 -06:00
Behdad Esfahbod
cedf739646
Add some commented-out code
2022-05-18 16:53:26 -06:00
Behdad Esfahbod
6b62c10f02
[priority-queue] Remove old init/fini
2022-05-18 16:27:54 -06:00
Behdad Esfahbod
bff8248a9d
[repacker] Pre-alloc vertices
2022-05-18 16:25:03 -06:00
Behdad Esfahbod
39a424caf0
[priority-queue] Optimize heap access
2022-05-18 16:19:44 -06:00
Behdad Esfahbod
9308659fd7
[priority-queue] Optimize swap()
2022-05-18 16:14:25 -06:00
Behdad Esfahbod
c7317ef761
[repacker] Avoid destroying and recreating objects
2022-05-18 16:03:41 -06:00
Behdad Esfahbod
864e09a0c4
[repacker] Reuse allocated vector
2022-05-18 15:59:29 -06:00
Behdad Esfahbod
ca77f16470
[repacker] Remove unnecessary vector .fini() calls
2022-05-18 15:55:49 -06:00
Behdad Esfahbod
4cfc2d668e
[subset] Use a std::move on set_t when feasible
2022-05-18 15:32:19 -06:00
Behdad Esfahbod
1f578b5a32
[set] Add pre-allocation internal API
2022-05-18 15:25:00 -06:00
Garret Rieger
48dfbd54a3
[subset] minor cleanup.
2022-05-18 15:24:54 -06:00
Garret Rieger
482c6e5dc4
[subset-perf] Speed up Coverage::serialize by caching iterator.
2022-05-18 15:24:54 -06:00
Behdad Esfahbod
14b18725f0
In Coverage::iter_t, assume iterators are from same Coverage object
...
No need to support otherwise.
2022-05-18 15:14:32 -06:00
Behdad Esfahbod
27141735c3
[subset] Add Coverage::__end__ implementation
2022-05-18 15:12:49 -06:00
Behdad Esfahbod
c476f58adb
[subset] Write CoverageFormat2::intersects_coverage() as bsearch()
2022-05-18 14:20:23 -06:00
Behdad Esfahbod
63c6695108
[ot-layout] Cosmetic
...
The implementation of HBUINT16 operator == is slower than just
comparing to ints.
2022-05-18 13:53:52 -06:00
Behdad Esfahbod
777debd748
[subset] Rewrite CoverageFormat2::intersects as dagger
2022-05-18 13:46:06 -06:00
Behdad Esfahbod
cf5001fac7
[subset] Optimize CoverageFormat2::intersected_coverage_glyphs
2022-05-18 13:38:29 -06:00
Behdad Esfahbod
6f37c20798
[subset] Minor rewrite in CoverageFormat2::serialize()
2022-05-18 13:25:42 -06:00
Behdad Esfahbod
e91863b717
[subset-cff] Pre-size map in subr_remap_t::create()
2022-05-18 12:39:55 -06:00
Behdad Esfahbod
ce60462173
[subset-plan] Pre-size maps in _create_old_gid_to_new_gid_map()
2022-05-18 12:34:27 -06:00
Behdad Esfahbod
f82ee17a75
[map] Pre-size map in constructor if we can
2022-05-18 12:19:49 -06:00
Behdad Esfahbod
b5aa8a27ea
[subset-cff] Cosmetic
2022-05-18 11:58:58 -06:00
Behdad Esfahbod
0b201623f5
[subset-cff] Fix previous commit
...
Oops!
2022-05-18 11:58:22 -06:00
Behdad Esfahbod
4792309265
[subset-cff] Access vector directly
2022-05-18 11:54:08 -06:00
Behdad Esfahbod
7c86f2e763
[subset-cff] Pre-alloc out buffer
2022-05-18 11:45:27 -06:00
Behdad Esfahbod
0761e7cdfd
[subset-cff] Avoid resetting buffer as encoder does
2022-05-18 11:38:25 -06:00
Behdad Esfahbod
71aa10a394
[subset-cff] Manually grow vector to avoid memset overhead
2022-05-18 11:37:24 -06:00
Behdad Esfahbod
f455cc53fd
[subset-cff] Reuse buffer allocation
2022-05-18 11:31:55 -06:00
Behdad Esfahbod
e24797aeac
[ot-tags] Follow-up to previous commit
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
2022-05-18 11:10:10 -06:00
Behdad Esfahbod
f5d619be79
[ot-tags] Further gate the slow complex case, and add more tests
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
Still 'zh-trad' is the slowest case.
--------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON zh_trad 136 ns 136 ns 5107838
BM_hb_ot_tags_from_script_and_language/COMMON ab_abcd 115 ns 115 ns 6103104
BM_hb_ot_tags_from_script_and_language/COMMON ab_abc 25.4 ns 25.3 ns 27674482
BM_hb_ot_tags_from_script_and_language/COMMON abcdef_XY 20.2 ns 20.1 ns 34795719
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 19.4 ns 19.3 ns 36390401
BM_hb_ot_tags_from_script_and_language/COMMON cxy_CN 33.5 ns 33.4 ns 20998939
BM_hb_ot_tags_from_script_and_language/COMMON exy_CN 25.1 ns 25.0 ns 27705832
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 34.2 ns 34.1 ns 20564356
BM_hb_ot_tags_from_script_and_language/COMMON en_US 15.5 ns 15.5 ns 45032204
BM_hb_ot_tags_from_script_and_language/LATIN en_US 15.9 ns 15.8 ns 44412379
BM_hb_ot_tags_from_script_and_language/COMMON none 4.72 ns 4.71 ns 149101665
BM_hb_ot_tags_from_script_and_language/LATIN none 4.72 ns 4.70 ns 149254498
2022-05-18 11:04:52 -06:00
Behdad Esfahbod
9c64bda21d
[ot-tag] Whitespace
2022-05-17 17:31:18 -06:00
Behdad Esfahbod
3df8017e9b
[ot-tag] Optimize subtag_matches() more
2022-05-17 17:29:39 -06:00
Behdad Esfahbod
7f6e8c5536
[ot-tags] Optimize subtag_matches() further
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
Comparing before to after
Benchmark Time CPU Time Old Time New CPU Old CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY -0.3371 -0.3371 71 47 71 47
2022-05-17 16:58:35 -06:00
Behdad Esfahbod
27c11405a2
[ot-tag] Optimize subtag_matches
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
2022-05-17 16:51:51 -06:00
Behdad Esfahbod
a07d818597
[ot-tag] Add a likely() to the cache hit case
2022-05-17 16:46:10 -06:00
Behdad Esfahbod
dfca47f419
[ot-tag] Cache last bsearch result
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
Humm. Looks like not all of the fat is bsearch overhead now. I cached
the last bsearch result, but most of the time is still there. I'm
baffled.
Before:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.08 ns 8.05 ns 84500482
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 42.2 ns 42.1 ns 16722006
BM_hb_ot_tags_from_script_and_language/COMMON en_US 16.1 ns 16.0 ns 43461527
BM_hb_ot_tags_from_script_and_language/LATIN en_US 16.5 ns 16.5 ns 42448505
BM_hb_ot_tags_from_script_and_language/COMMON none 4.34 ns 4.33 ns 161290530
BM_hb_ot_tags_from_script_and_language/LATIN none 4.34 ns 4.33 ns 162339799
After:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.13 ns 8.11 ns 80438134
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 40.0 ns 39.9 ns 17487939
BM_hb_ot_tags_from_script_and_language/COMMON en_US 12.7 ns 12.7 ns 55124394
BM_hb_ot_tags_from_script_and_language/LATIN en_US 13.1 ns 13.0 ns 53660125
BM_hb_ot_tags_from_script_and_language/COMMON none 4.61 ns 4.60 ns 151394104
BM_hb_ot_tags_from_script_and_language/LATIN none 4.70 ns 4.68 ns 150402847
2022-05-17 16:21:02 -06:00
Behdad Esfahbod
909f00ac6e
[ot-tags] Further speed up language bsearch()
...
Using an integer tag to bsearch, instead of string.
Part of: https://github.com/harfbuzz/harfbuzz/issues/3591
Before:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.11 ns 8.08 ns 87067795
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 53.6 ns 53.5 ns 13042418
BM_hb_ot_tags_from_script_and_language/COMMON en_US 24.2 ns 24.1 ns 29052731
BM_hb_ot_tags_from_script_and_language/LATIN en_US 24.4 ns 24.3 ns 28736769
BM_hb_ot_tags_from_script_and_language/COMMON none 4.43 ns 4.41 ns 160370413
BM_hb_ot_tags_from_script_and_language/LATIN none 4.35 ns 4.34 ns 160578191
After:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 7.97 ns 7.95 ns 85208363
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 41.7 ns 41.6 ns 16945817
BM_hb_ot_tags_from_script_and_language/COMMON en_US 16.1 ns 16.0 ns 43613523
BM_hb_ot_tags_from_script_and_language/LATIN en_US 16.5 ns 16.4 ns 42568107
BM_hb_ot_tags_from_script_and_language/COMMON none 4.30 ns 4.29 ns 164055469
BM_hb_ot_tags_from_script_and_language/LATIN none 4.29 ns 4.27 ns 163793591
2022-05-17 15:51:41 -06:00
Behdad Esfahbod
c460cf74ce
[ot-tags] Cosmetic
2022-05-17 15:30:11 -06:00
Behdad Esfahbod
1c8226ed14
Fix compiler warning
...
On Mac compiler:
FAILED: src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o
c++ -Isrc/libharfbuzz.0.dylib.p -Isrc -I../src -I. -I.. -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/glib/2.72.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.72.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -Xclang -fcolor-diagnostics --coverage -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -fno-rtti -O2 -g -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -DHAVE_CONFIG_H -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -MF src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o.d -o src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -c ../src/hb-ot-tag.cc
In file included from ../src/hb-ot-tag.cc:29:
In file included from ../src/hb.hh:481:
../src/hb-array.hh:359:14: error: missing default argument on parameter 'ds'
Ts... ds) const
^
../src/hb-ot-tag.cc:292:58: note: in instantiation of function template specialization 'hb_sorted_array_t<const LangTag>::bfind<const char *, unsigned int>' requested here
if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx,
^
1 error generated.
2022-05-17 15:28:50 -06:00
Behdad Esfahbod
c1f4b57c06
[ot-tags] Optimize language comparison
...
Now that we know both strings are of equal len of 2 or 3, optimize.
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
Before:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.50 ns 8.47 ns 81221549
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 79.6 ns 79.3 ns 8785804
BM_hb_ot_tags_from_script_and_language/COMMON en_US 40.0 ns 39.9 ns 17462768
BM_hb_ot_tags_from_script_and_language/LATIN en_US 39.2 ns 39.1 ns 17886793
BM_hb_ot_tags_from_script_and_language/COMMON none 4.31 ns 4.30 ns 162805417
BM_hb_ot_tags_from_script_and_language/LATIN none 4.32 ns 4.31 ns 162656688
After:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.27 ns 8.24 ns 81868701
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 56.1 ns 56.0 ns 12353284
BM_hb_ot_tags_from_script_and_language/COMMON en_US 24.3 ns 24.2 ns 28955030
BM_hb_ot_tags_from_script_and_language/LATIN en_US 24.5 ns 24.4 ns 28664868
BM_hb_ot_tags_from_script_and_language/COMMON none 4.35 ns 4.34 ns 161190014
BM_hb_ot_tags_from_script_and_language/LATIN none 4.36 ns 4.34 ns 161319000
2022-05-17 15:19:40 -06:00
Behdad Esfahbod
dde48d78c1
Fix compiler warning
2022-05-17 15:07:49 -06:00
Behdad Esfahbod
15be0deda0
[ot-tags] Optimize lang_matches()
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
Before:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.67 ns 8.64 ns 80324382
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 91.2 ns 90.9 ns 7674131
BM_hb_ot_tags_from_script_and_language/COMMON en_US 41.1 ns 41.0 ns 17174093
BM_hb_ot_tags_from_script_and_language/LATIN en_US 41.3 ns 41.2 ns 17000876
BM_hb_ot_tags_from_script_and_language/COMMON none 4.56 ns 4.55 ns 153914130
BM_hb_ot_tags_from_script_and_language/LATIN none 4.53 ns 4.52 ns 153830303
After:
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.24 ns 8.21 ns 84078465
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 77.5 ns 77.2 ns 9059230
BM_hb_ot_tags_from_script_and_language/COMMON en_US 38.8 ns 38.7 ns 17790692
BM_hb_ot_tags_from_script_and_language/LATIN en_US 37.6 ns 37.5 ns 18648293
BM_hb_ot_tags_from_script_and_language/COMMON none 4.50 ns 4.49 ns 155573267
BM_hb_ot_tags_from_script_and_language/LATIN none 4.49 ns 4.47 ns 156456653
2022-05-17 14:57:08 -06:00
Behdad Esfahbod
dd3c858f84
[ot-tags] Speed up hb_ot_tags_from_language()
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
"After that, bulk of the time I suppose is spent in binary-searching the
language table. I suggest we split the language table in 2-letter and
3-letter tags, to speed-up the vast majority of cases that are
2-letter."
benchmark-ot, before:
----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 112 ns 111 ns 6286271
BM_hb_ot_tags_from_script_and_language/COMMON en_US 60.6 ns 60.4 ns 11671176
BM_hb_ot_tags_from_script_and_language/LATIN en_US 61.3 ns 61.1 ns 11442645
BM_hb_ot_tags_from_script_and_language/COMMON none 4.75 ns 4.74 ns 146997235
BM_hb_ot_tags_from_script_and_language/LATIN none 4.65 ns 4.64 ns 150938747
After:
----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 89.5 ns 89.2 ns 7747649
BM_hb_ot_tags_from_script_and_language/COMMON en_US 38.5 ns 38.4 ns 18199432
BM_hb_ot_tags_from_script_and_language/LATIN en_US 39.0 ns 38.9 ns 18049238
BM_hb_ot_tags_from_script_and_language/COMMON none 4.53 ns 4.52 ns 154895110
BM_hb_ot_tags_from_script_and_language/LATIN none 4.54 ns 4.52 ns 154762105
2022-05-17 14:28:28 -06:00
Behdad Esfahbod
9baccb9860
[ot-tags] Speed up hb_ot_tags_from_complex_language()
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
2. All the subtag_matches outside the switch match long strings (>= 6 or so).
As such, check the tag for such length before going into any of them.
benchmark-ot, before:
----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 172 ns 171 ns 4083155
BM_hb_ot_tags_from_script_and_language/COMMON en_US 120 ns 119 ns 5849947
BM_hb_ot_tags_from_script_and_language/LATIN en_US 113 ns 112 ns 5840326
BM_hb_ot_tags_from_script_and_language/COMMON none 4.66 ns 4.64 ns 151396224
BM_hb_ot_tags_from_script_and_language/LATIN none 4.66 ns 4.64 ns 149019593
After:
----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 112 ns 112 ns 6357763
BM_hb_ot_tags_from_script_and_language/COMMON en_US 60.5 ns 60.3 ns 11475091
BM_hb_ot_tags_from_script_and_language/LATIN en_US 54.9 ns 54.8 ns 12575690
BM_hb_ot_tags_from_script_and_language/COMMON none 4.61 ns 4.59 ns 152388450
BM_hb_ot_tags_from_script_and_language/LATIN none 4.66 ns 4.64 ns 151497600
2022-05-17 13:34:34 -06:00
Behdad Esfahbod
fb413f5202
[subset/cff] Don't use bitfields for hot bools
...
The struct has room because of alignment, and these bools are hot.
2022-05-16 17:38:18 -06:00
Behdad Esfahbod
a4d98b63ea
[subset/cff1] Collect glyph-to-sid map to avoid an O(n^2) algorithm
...
Saves 13 for largest benchmark:
BM_subset/subset_glyphs/SourceHanSans-Regular_subset.otf/10000 -0.1313 -0.1308 75 65 75 65
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/4096 -0.1009 -0.1004 54 48 54 48
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/10000 -0.1067 -0.1066 70 62 69 62
2022-05-16 17:38:18 -06:00
Behdad Esfahbod
b87f48e948
[cff1] get_sid() move bounds check into each implementation
2022-05-16 17:38:18 -06:00
Behdad Esfahbod
e1e359b4da
[cff1] Tighten up range_list_t a bit
2022-05-16 16:36:28 -06:00
Behdad Esfahbod
3fbac0942d
[cff1] Lazy-load & sort glyph names
...
Improves subset benchmarks by up to 70% for small CFF1 subset of
non-CID fonts!
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/10 -0.7067 -0.7071 1 0 1 0
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/64 -0.4817 -0.4824 1 0 1 0
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/512 -0.1948 -0.1956 2 2 2 2
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/2000 -0.0767 -0.0761 6 6 6 6
2022-05-16 16:36:28 -06:00
Behdad Esfahbod
b58bfd9818
[font] Minor move of code to silence gcc-12 warning
...
See mailing list discussion.
2022-05-16 11:21:45 -06:00
Behdad Esfahbod
602e0ca79d
[cff] Minor restructure of struct
...
Surprisingly this shows tiny benchmark improvement consistently.
2022-05-16 10:14:34 -06:00
Behdad Esfahbod
acdab17ed3
[cff] Cosmetic in parsed_values_t
2022-05-13 14:14:36 -06:00
Behdad Esfahbod
b46c7faa9c
[cff] Check buf_len, not buf
...
Ouch!
2022-05-13 14:02:54 -06:00
Garret Rieger
19a8db8545
[subset] fix potential integer overflow in gname_t::cmp.
2022-05-13 13:55:39 -06:00
Behdad Esfahbod
2d2f66e1a3
[cff-common] In INDEX, return empty bytes if length is zero
...
Before it was possible to return non-null arrayZ.
2022-05-13 13:53:17 -06:00
Behdad Esfahbod
a2f132f1fc
[cff] Check glyph-name's length, not arrayZ
...
As the latter can be non-null while still zero-length.
2022-05-13 13:49:39 -06:00
Thomas Devoogdt
c657c4e1f8
[meta] fix type traits on gcc 4.9 #3526
...
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
2022-05-13 11:26:12 -06:00
Behdad Esfahbod
e61234c5f7
[vector] Add tests for move constructor/assignment
2022-05-12 13:20:10 -06:00
Behdad Esfahbod
7fa580bc4f
[map] Fix map copy/move constructors to actually work
...
Ouch!
2022-05-12 13:05:32 -06:00
Behdad Esfahbod
a09dd87ca3
[set] Fix set copy/move constructors to actually work
...
Ouch!
2022-05-12 12:58:07 -06:00
Behdad Esfahbod
76fc27713f
[vector] Remove explicit std::move
...
Was confusing compilers. Let them figure it out themselves.
Makes NotoNastaliqu subsetting/1000 benchmark more than twice faster:
Benchmark Time CPU Time Old Time New CPU Old CPU New
------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_glyphs/NotoNastaliqUrdu-Regular.ttf/1000 -0.5064 -0.5065 111 55 110 55
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/1000 -0.5494 -0.5493 132 59 131 59
2022-05-12 12:14:07 -06:00
Behdad Esfahbod
c81198b5bc
[set] Tweak move operators a bit
...
Should be equivalent.
2022-05-12 12:14:02 -06:00
Behdad Esfahbod
175319cd89
[gsubgpos] Clean up OT::ClassDefFormat2::intersected_class_glyphs 0 case
2022-05-11 13:47:17 -06:00
Behdad Esfahbod
137af3612b
[gsubgpos] Simplify OT::ClassDefFormat2::intersected_class_glyphs()
2022-05-11 13:39:30 -06:00
Behdad Esfahbod
3261e05bdb
[subset] Optimize ClassDef1::intersected_class_glyphs() for class0
2022-05-11 13:16:31 -06:00
Behdad Esfahbod
c78d8ba60b
[subset] Allocate same size as source table for GSUB/GPOS/name
2022-05-11 13:05:41 -06:00
Behdad Esfahbod
2e7f1ae48f
[subset] Use vector.allocated size instead of tracking buf_size
2022-05-11 12:52:27 -06:00
Behdad Esfahbod
f08537963b
[cff-subset] Pre-alloc vector for operator decoding
2022-05-11 12:14:49 -06:00
Behdad Esfahbod
aeb50b8942
[subset] Retain buffer across table subset operations
2022-05-11 12:14:49 -06:00
Behdad Esfahbod
bff78e6515
[cff] Convert interpretation environment to use constructor
2022-05-10 16:50:38 -06:00
Behdad Esfahbod
de053e2efb
[cff] Convert subr_subset_param_t to use constructor
2022-05-10 16:17:20 -06:00
Behdad Esfahbod
96140db485
[cff] Convert cff2_extents_param_t to use constructor
2022-05-10 16:17:20 -06:00
Behdad Esfahbod
54544f2a57
[cff] Convert cff1_extents_param_t to use constructor
2022-05-10 16:17:20 -06:00
Behdad Esfahbod
377befd0c7
[cff] Convert get_seac_param_t to use constructor
2022-05-10 16:17:20 -06:00
Behdad Esfahbod
8fd70362fa
[cff] Use hb_ubytes_t() instead of Null(hb_ubytes_t)
2022-05-10 16:17:20 -06:00
Behdad Esfahbod
9033c7f99d
[cff-common] Optimize INDEX::operator[]
...
Previous try showed slowdown in benchmarks, suprisingly.
Rewrite it keeping the function, hopefully allowing better optimization.
2022-05-10 14:58:53 -06:00
Behdad Esfahbod
3aace2431b
Revert "[cff-common] Optimize INDEX::operator[]"
...
This reverts commit 9edb03ac7a
.
2022-05-10 14:54:04 -06:00
Behdad Esfahbod
b31ef081db
Revert "[cff] Add an unlikely()"
...
This reverts commit 9ba9adb7ed
.
This shows slowdown in benchmarks.
2022-05-10 14:52:40 -06:00
Behdad Esfahbod
9ba9adb7ed
[cff] Add an unlikely()
2022-05-10 14:43:00 -06:00
Behdad Esfahbod
9edb03ac7a
[cff-common] Optimize INDEX::operator[]
2022-05-10 14:43:00 -06:00
Behdad Esfahbod
0a42410dc8
[cff2] Change extents/shape stack to be just a number
...
Do the blending immediately.
Fixes https://github.com/harfbuzz/harfbuzz/issues/3559
Benchmark on AdobeVFPrototype shows 35% speedup. Now we're faster
than FreeType:
Benchmark Time CPU Time Old Time New CPU Old CPU New
------------------------------------------------------------------------------------------------------------------------------------------------
BM_Font/glyph_extents/AdobeVFPrototype.otf/hb -0.3792 -0.3792 1584 983 1581 982
BM_Font/glyph_extents/AdobeVFPrototype.otf/ft +0.0228 +0.0224 1220 1248 1218 1245
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/hb -0.3513 -0.3518 1616 1048 1613 1046
BM_Font/glyph_extents/AdobeVFPrototype.otf/var/ft +0.0172 +0.0169 1232 1254 1230 1251
2022-05-10 13:41:12 -06:00
Garret Rieger
8f9f0c494b
[subset] Enforce cmap12 group ordering constraints in collect_mapping.
...
Fixes fuzzer issue: https://oss-fuzz.com/testcase-detail/6365271012540416
2022-05-10 12:15:09 -06:00
Behdad Esfahbod
1b14d2ff13
[cff] Fix arg-stack peek() impl
2022-05-09 18:15:31 -06:00
Behdad Esfahbod
6106ef8c0f
[cff] Tighten up arg-stack access
2022-05-09 18:15:11 -06:00
Behdad Esfahbod
8c616a6efe
[cff] Allocate stack inline instead of using hb_vector_t
...
Speeds up glyph_extents and glyph_shape benchmarks for CFF by 10
to 16 percent!
2022-05-09 17:50:59 -06:00
Behdad Esfahbod
c941ece60f
[cff] Use using instead of typedef
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
64d63cebe2
[cff-common] Use existing types for str_buff_vec_t
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
e1838ec1f8
[cff-common] Remove unused method
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
8aa54aaca2
[cff] Replace byte_str_t with hb_bytes_t use
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
fe1d85a55a
[cff] Remove custom byte_str_t impl
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
c8a5f1e3c0
[cff-common] Indent
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
be7b2905cb
[cff-common] Remove unused INDEX::serialize() method
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
60390169b6
[cff-common] Write str_buf_t::total_size() as dagger
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
258afb45b7
[cff-common] Use range-based loop in str_buff_vec_t
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
8bb1a3ce9a
[cff-common] Write INDEX offset-size calc using hb_bit_storage()
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
2ccfe84eff
[cff-common] Add assert to INDEX::set_offset_at()
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
4bcab9e99a
[cff-common] Use byte_str_t() instead of Null(byte_str_t)
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
94f7a26322
[cff-common] Fix get_size() for Null object
...
The special-casing didn't make sense.
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
c9cc7d5d21
[cff-common] Inline once-used method in INDEX
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
11482a3a39
[cff-common] Remove unused method from INDEX
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
d1bb3b08f6
[cff-common] Hide more INDEX internals
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
d3b21387fd
[cff-common] Remove redundant operator implementation
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
a96b408d80
[cff-common] Hide INDEX internals
2022-05-09 17:34:58 -06:00
Behdad Esfahbod
335b1d83cf
[cff-common] No need to check max-offset in INDEX
...
The length_at() function makes sure out-of-range offsets
are discarded. We just need to check the last offset.
2022-05-09 17:34:58 -06:00
Garret Rieger
b051f3fa83
[subset] Fix cpal subsetting when there are partial palette overlaps.
...
The existing code doesn't correctly handle the case where palettes partially overlap in the color record array. This changes the subsetting to only share entries in the color record array when palettes have the same first color index. Partially overlapping palettes will be converted to disjoint segments in the color record array.
Updates one of the color tests to use multiple palettes.
Also fixes fuzzer: https://oss-fuzz.com/testcase-detail/5568200165687296 .
2022-05-09 12:25:05 -06:00