Commit Graph

11420 Commits

Author SHA1 Message Date
Behdad Esfahbod 2d098d5d7f [gvar] Use memset 2022-11-22 11:51:04 -07:00
Behdad Esfahbod e630a65e60 [gvar] Micro-optize vector extend 2022-11-22 11:29:13 -07:00
Behdad Esfahbod 49d4f62135 [gvar] Micro-optimize 2022-11-22 11:14:56 -07:00
Behdad Esfahbod 1758ee6646 [glyf] Minor write loop more idiomatically 2022-11-22 10:55:16 -07:00
Behdad Esfahbod 16ec9dcc1b [gvar] Whitespace 2022-11-22 10:55:16 -07:00
Behdad Esfahbod b567ce51d3 [subset] Don't trim glyf's again if preprocessed
Speeds up M1/10000 benchmark by 30%!
2022-11-22 10:55:08 -07:00
Behdad Esfahbod 72059a4789 [gvar] Optimize IUP alg 2022-11-22 10:41:37 -07:00
Behdad Esfahbod ee9873b5ed [gvar] Disable initializing vectors when not necessary 2022-11-22 10:23:17 -07:00
Behdad Esfahbod b0d2641186 [vector] Add "initialize" argument to resize() 2022-11-22 10:20:11 -07:00
Behdad Esfahbod a2059f8f55 [gvar] Optimize unpack_points 2022-11-22 10:16:21 -07:00
Behdad Esfahbod 6d7206b68b [gvar] Optimize unpack_deltas 2022-11-22 10:13:14 -07:00
Behdad Esfahbod bca569ae53 [array] Speed up hash() for byte arrays 2022-11-21 23:19:42 -07:00
Behdad Esfahbod d7b492e3f5 Revert "[array] Remove hash specializations for bytes"
This reverts commit 213117317c.
2022-11-21 23:08:51 -07:00
Behdad Esfahbod 1572ba281a [subset-cff] Return in subr closure if already seen subr
Not sure why this was not done before.
2022-11-21 22:26:44 -07:00
Behdad Esfahbod a29ca6efbc [subset-cff] Comment 2022-11-21 22:02:17 -07:00
Behdad Esfahbod 28e767ddea [subset-cff] Really optimize op_str_t / parsed_cs_op_t layout
Now parsed_cs_op_t and op_str_t are both 16 bytes.

Saves another 7% in SourceHanSans/10000 benchmark.
2022-11-21 21:59:51 -07:00
Behdad Esfahbod 2d5ee23731 [subset-cff] Readjust parsed_cs_op_t
Now it doesn't matter anymore since op_str_t is adjusted and
is 16 bytes with 8byte alignment.
2022-11-21 21:55:21 -07:00
Behdad Esfahbod 4f056b923a [subset-cff] Optimize op_str_t layout 2022-11-21 21:37:57 -07:00
Behdad Esfahbod a750cb0128 Simplify rvalue creation 2022-11-21 21:03:32 -07:00
Behdad Esfahbod 86a763c651 [map] Make keys moveable 2022-11-21 20:53:44 -07:00
Behdad Esfahbod cf20d2ec5d [map] Take const key 2022-11-21 20:47:17 -07:00
Behdad Esfahbod 3d1c76f713 [serializer] Don't hash objects twice 2022-11-21 19:40:32 -07:00
Behdad Esfahbod 35878df215 [algs] Implement swap() for pair_t
Helps priority_queue::pop_minimum and friends, which help subsetter
repacker. Shows a few percentage improvement on NotoNastaliq benchmark.
2022-11-21 19:14:03 -07:00
Behdad Esfahbod a2984a2932 [cff] Remove unnecessary namespacing 2022-11-21 18:40:52 -07:00
Behdad Esfahbod dc3bb5e0ed [subset-cff] Pre-allocate values array for subroutines as well 2022-11-21 18:18:48 -07:00
Behdad Esfahbod c6279224db [cff] Adjust pre-allocation
This better matches actual usage, given that ops are one or two
bytes, and vector also allocates 50% extra.
2022-11-21 18:01:50 -07:00
Behdad Esfahbod bab8ec58b0 [subset-cff] Disable sharing when packing charstring INDEXes
Saves another 8%ish.
2022-11-21 17:46:32 -07:00
Behdad Esfahbod 2cadacad6c [cff] Simplify str_encoder_t error handling 2022-11-21 17:17:15 -07:00
Behdad Esfahbod f263e3fe2e [cff] Manually copy short strings instead of memcpy() 2022-11-21 17:04:55 -07:00
Behdad Esfahbod 38efd1862f [cff] Add a likely() 2022-11-21 17:02:11 -07:00
Behdad Esfahbod 191025cc96 [cff] Adjust buffer pre-allocation
Most ops take one or two bytes, so allocate count*2, not count*3.
Shows minor speedup in subsetting benchmark (around 2%).
2022-11-21 16:58:19 -07:00
Behdad Esfahbod 4b2caafea2 [subset-cff] Optimize parsed_cs_op_t size
Shows 5% speedup on SourceHanSans-Regular/10000 benchmark.
2022-11-21 16:46:20 -07:00
Behdad Esfahbod e0b06bd1b1 [subset] Cache has_seac in accelerator
Speeds up SourceHanSans-Regular/10000 benchmark by %25.
2022-11-21 16:30:34 -07:00
Garret Rieger dd1ba328a8 [repacker] fix fuzzer timeout.
For https://oss-fuzz.com/testcase-detail/5845846876356608. Only process the set of unique overflows.
2022-11-21 16:24:48 -07:00
Behdad Esfahbod 59451502e9 [cff] Optimize env error checking 2022-11-21 15:23:16 -07:00
Behdad Esfahbod b238578a9c [cff] Optimize INDEX operator[] 2022-11-21 14:36:57 -07:00
Behdad Esfahbod d9de515a38 [cff] Optimize byte_str_ref_t array access 2022-11-21 14:23:07 -07:00
Behdad Esfahbod a81ec9b2b6 [cff] Optimize byte_str_ref_t inc()
Shows a couple percent speedup.
2022-11-21 14:03:28 -07:00
Behdad Esfahbod 3ff75411bd [algs] Fix bot fail 2022-11-21 13:08:55 -07:00
Behdad Esfahbod b81e3989f8 Try fixing arm-eabi build after a10cfe3f32 2022-11-21 13:02:40 -07:00
Behdad Esfahbod 4c14043b06 [algs] Add output argument to hb_unsigned_mul_overflows() 2022-11-21 12:56:33 -07:00
Behdad Esfahbod 25adbb3825 [algs] Use __builtin_mul_overflow
Compiles to smaller binary.
2022-11-21 12:47:53 -07:00
Behdad Esfahbod a10cfe3f32 [algs] Write hb_in_ranges() recursively 2022-11-21 12:37:59 -07:00
Behdad Esfahbod 2e86700e30 [gvar] Add memory-barrier as in ArrayOf 2022-11-21 12:28:10 -07:00
Behdad Esfahbod b00a911fa7 [sorted-array] Add faster iterator implementation here as well 2022-11-21 12:11:30 -07:00
Behdad Esfahbod 7cc79a8a86 [vector] Adjust comment 2022-11-21 12:09:24 -07:00
Behdad Esfahbod e82a3c69dd [array/vector] Optimize range-based for-loop
Avoid bounds-checking.
2022-11-21 12:00:10 -07:00
Behdad Esfahbod 0387182c2a [ot-map] Minor refactor features[i] access 2022-11-21 11:05:47 -07:00
Behdad Esfahbod 5ee6d5d77e [cff] Add memory-barrier to INDEX
Like we do for ArrayOf.
2022-11-21 11:00:29 -07:00
Behdad Esfahbod 6905d36d73 [cff] Fix fetch_op() bounds-checking 2022-11-21 10:51:33 -07:00
Behdad Esfahbod b51ab1a9e5 [cff] Optimize byte_str_ref_t
Make it 16 bytes instead of 24.  This struct is used in the subroutine
call stack heavily.

This change makes the HB AdobeVFPrototype benchmark to become faster
than FT one, with about 6% speedup as a result of this change.
2022-11-21 10:27:07 -07:00
Behdad Esfahbod 7a39464b18 [cff] Hide members of byte_str_ref_t 2022-11-21 09:48:54 -07:00
Behdad Esfahbod 18141f0007 [cff] Move a sub_array call
No logic change.... I hope?!
2022-11-21 09:47:03 -07:00
Behdad Esfahbod f66415cdd1 [cff] Move initialization of a type to constructor 2022-11-21 09:40:16 -07:00
Behdad Esfahbod 70a5cd53f6 [algs] Assert trivial copy assignable in stable_sort 2022-11-21 08:52:33 -07:00
Behdad Esfahbod 9bb39423f5 [algs] Simplify stable_sort signatures 2022-11-20 17:40:54 -07:00
Behdad Esfahbod d119568df6 [cbdt] Use vector tail() 2022-11-20 14:11:51 -07:00
Behdad Esfahbod 87a88117c8 [object] Use vector tail() 2022-11-20 14:10:39 -07:00
Behdad Esfahbod 76ce390b5a [ucd] Document algorithms 2022-11-20 13:54:56 -07:00
Behdad Esfahbod ed43bc5118 [buffer] Move delete_glyphs_inplace() here 2022-11-20 13:10:19 -07:00
Behdad Esfahbod dd88dae8a9 [unicode] Simplify set_funcs a bit more 2022-11-19 15:23:53 -07:00
Behdad Esfahbod 2d8ff3bcbe [unicode] Destroy user_data in set_funcs fail paths
This is what the font_funcs / draw_funcs do.
2022-11-19 15:23:44 -07:00
Behdad Esfahbod 527823ccac [unicode] Destroy user_data in set_funcs fail paths
This is what the font_funcs / draw_funcs do.
2022-11-19 15:19:08 -07:00
Behdad Esfahbod 56d6b6992b [font/draw] Remove unneeded branch
The preamble sets user_data/destroy to nullptr if func is nullptr.
2022-11-19 15:11:59 -07:00
Behdad Esfahbod 976bb26cc1 [draw] Optimize set_func functions 2022-11-19 15:06:23 -07:00
Behdad Esfahbod 114167a933 [font] Optimize set_func functions 2022-11-19 14:47:45 -07:00
Behdad Esfahbod f9d7b303ed [thai] Use smaller type for arrays
No logic change.
2022-11-19 14:20:36 -07:00
Behdad Esfahbod 72c4e431af [use-table] Add a OPTIMIZE_SIZE version 2022-11-19 13:40:33 -07:00
Behdad Esfahbod 83c3a91dc6 [gen-use-table] Report fullCost 2022-11-19 13:34:58 -07:00
Behdad Esfahbod ba08de624e [ucd] Change OPTIMIZE_SIZE to compression level 9
Also changes default compression level from 3 to 5, but that shows
no change in the generated table size.
2022-11-19 13:25:19 -07:00
Behdad Esfahbod b68f9f3cfe [machinery] Adjust comment 2022-11-18 21:36:01 -07:00
Behdad Esfahbod a47ba1dc0e [lazy-pointer] Hide instance 2022-11-18 21:14:07 -07:00
Behdad Esfahbod 281b4705b4 [pool] Rewrite a loop as dagger 2022-11-18 20:25:05 -07:00
Behdad Esfahbod 3ff8abf272 Revert "[map] Allow std::move-ing keys into the map"
This reverts commit f657ef7e57.

This breaks many compilers with messages like this:

hb-subset-plan.hh:226: undefined reference to `OT::head::tableTag'

I'm out of my depth re how to fix it.
2022-11-18 19:38:12 -07:00
Behdad Esfahbod 039e476bac [test-vector] Test sink-move'ing 2022-11-18 19:26:02 -07:00
Behdad Esfahbod a3a218edb5 [map] Add a couple more sink interfaces 2022-11-18 19:24:41 -07:00
Behdad Esfahbod 90226eab89 [test-map] Test inserting shared_ptr key 2022-11-18 19:21:58 -07:00
Behdad Esfahbod f657ef7e57 [map] Allow std::move-ing keys into the map 2022-11-18 19:17:03 -07:00
Behdad Esfahbod a1768ad829 [map] Fix use of != 2022-11-18 19:08:34 -07:00
Behdad Esfahbod e74b372b59 [test-map] Test moving values 2022-11-18 18:43:31 -07:00
Behdad Esfahbod a9c6a20b19 [map] Support moving value in sink interface 2022-11-18 18:29:12 -07:00
Behdad Esfahbod 1bf9afaad0 [test-vector] Test sink interface 2022-11-18 18:20:50 -07:00
Behdad Esfahbod fa0e4b041d [test-map] Test sink interface 2022-11-18 18:20:14 -07:00
Behdad Esfahbod 1c612a8541 [test-set] Test sinking range 2022-11-18 18:19:31 -07:00
Behdad Esfahbod 356708e34a [test-set] Test length of iterator 2022-11-18 18:17:34 -07:00
Behdad Esfahbod 2892fc71e8 [vector] Add std::move to pop()
This was removed in 76fc27713f,
but I believe that was faultly. It was because of a bad move
implementation in the set.
2022-11-18 18:03:59 -07:00
Behdad Esfahbod 921f45f46d [array] Rewrite hash() as dagger 2022-11-18 17:26:58 -07:00
Behdad Esfahbod 213117317c [array] Remove hash specializations for bytes
Not needed.
2022-11-18 17:24:44 -07:00
Behdad Esfahbod bef5a1c8dc [vector] Comment 2022-11-18 17:22:17 -07:00
Behdad Esfahbod 69b41f92ec [vector] Simplify shift_down_vector()
Compiler is smarter than I am.
2022-11-18 17:04:34 -07:00
Behdad Esfahbod 1dd9396c7a [vector] Optimize grow_vector() for size
Again, compiler is smarter than I am.
2022-11-18 17:01:14 -07:00
Behdad Esfahbod d36f688131 [vector] Optimize shrink_vector for size
Compiler is smarter than I am.
2022-11-18 17:00:07 -07:00
Behdad Esfahbod bc8eded296 [vector] Remove a for loop 2022-11-18 16:51:24 -07:00
Behdad Esfahbod afd9a58bd7 [vector] Save a couple hb_iter() invocations 2022-11-18 16:47:32 -07:00
Behdad Esfahbod 3ead9863d2 [map] Add size() 2022-11-18 16:43:47 -07:00
Behdad Esfahbod 42db8be189 [map] Minor remove if condition 2022-11-18 16:41:50 -07:00
Behdad Esfahbod 4ec706980c [map] Rewrite hash() as dagger
Somehow our daggers instead of for loop save size. I cannot
pinpoint why, other than maybe not inlining.
2022-11-18 16:39:30 -07:00
Behdad Esfahbod 025a68cb07 [map] Optimize copy resizing logic 2022-11-18 16:33:04 -07:00
Behdad Esfahbod f1d716871d [map] Change bucket_for_hash() to item_for_hash() 2022-11-18 16:31:27 -07:00
Behdad Esfahbod d012f9a9b3 [map] Change bucket_for() to item_for() 2022-11-18 16:29:06 -07:00
Behdad Esfahbod 68a29020c5 [bit-page] Write hash() as dagger 2022-11-18 16:02:45 -07:00
Behdad Esfahbod 87271e1b2e [bit-page] Write get_population as dagger 2022-11-18 16:01:23 -07:00
Behdad Esfahbod 744eb6baf9 [bit-page] Write is_empty() as dagger 2022-11-18 15:56:06 -07:00
Behdad Esfahbod 43a4028f0e [algs] Move hb_vector_size_t to bit-page as only user 2022-11-18 15:54:34 -07:00
Behdad Esfahbod 01f961ac3a [gsubgpos] Minor call hb_iter() instead of ->iter() directly 2022-11-18 15:47:17 -07:00
Behdad Esfahbod bba5765583 [gsubgpos] Remove a few unnecessary namespace invocations 2022-11-18 14:52:17 -07:00
Behdad Esfahbod b4d0d1608d [gsubgpos] Rewrite a couple apply() functions as daggers 2022-11-18 14:47:33 -07:00
Behdad Esfahbod 76c8214eb5 [gsubgpos] Move member around 2022-11-18 12:30:46 -07:00
Behdad Esfahbod 81a573008e [map] Optimize storage 2022-11-17 16:59:36 -07:00
Behdad Esfahbod ae080bf202 [map] Initialize key and value explicitly
If they are of int time they won't be initialized otherwise.
2022-11-17 16:34:58 -07:00
Behdad Esfahbod 1d41b9cb3c [user-data] std::move item 2022-11-17 16:26:48 -07:00
Behdad Esfahbod ff0bb74895 [map] Call item_t constructor/destructor directly 2022-11-17 16:17:37 -07:00
Behdad Esfahbod 5c88715949 [map] Add item_t.destruct() 2022-11-17 16:14:16 -07:00
Behdad Esfahbod 7f83040836 [map] Simplify (de)construction of item_t 2022-11-17 16:10:37 -07:00
Behdad Esfahbod 99103bd976 [map] Destruct objects when clearing 2022-11-17 15:57:06 -07:00
Behdad Esfahbod 4caad5720c [test-map] Add test for reset
I expect this to leak now, since we don't destruct items.
2022-11-17 15:51:39 -07:00
Behdad Esfahbod e93c01c3ae [map] Rename item clear() to construct() 2022-11-17 15:50:00 -07:00
Behdad Esfahbod fc22d706fe [test-map] Don't insert null smart-pointers in map
Dereferencing them is not supported anymore after
3aad7c2ddf

We don't support that for regular pointers, so don't supporting
them for smart-pointers sounds right to me.
2022-11-17 15:47:43 -07:00
Behdad Esfahbod 896377463f [map] Don't resize map if not necessary 2022-11-17 15:25:45 -07:00
Behdad Esfahbod 7595fa2d9a [map] Fix copy-assignment operator
Ouch!
2022-11-17 15:23:14 -07:00
Behdad Esfahbod 41f4bdac35 [map] Fix resize during copy-construction/assignment 2022-11-17 15:16:00 -07:00
Behdad Esfahbod 3aad7c2ddf [algs] Remove smart-pointers from hb_hash()
hb_deref() handles them. I think this code predated that.
2022-11-17 15:10:47 -07:00
Behdad Esfahbod 7bd101728a [map] Minor use hb_iter instead of hb_array 2022-11-17 15:01:55 -07:00
Behdad Esfahbod 238fc14716 [map] Simplify iterators 2022-11-17 14:58:50 -07:00
Behdad Esfahbod 410c14bfa2 [map] Fix equality
Ouch!
2022-11-17 14:53:00 -07:00
Behdad Esfahbod 6dfd4a16e7 [ot-font] Remove stale TODO 2022-11-16 22:44:22 -07:00
Behdad Esfahbod a0bde1e1ea [open-type] Remove (Sorted)ArrayOf.sub_array() 2022-11-16 21:27:12 -07:00
Behdad Esfahbod f2b5db700f [vector] Remove .sub_array () 2022-11-16 21:22:57 -07:00
Behdad Esfahbod c7d57dcf26 [vector/array] Simplify qsort() 2022-11-16 21:21:31 -07:00
Behdad Esfahbod 1610008e62 [gsubgpos] Minor remove call to hb_iter 2022-11-16 20:02:36 -07:00
Behdad Esfahbod 19ec01d25c [gsubgpos] Sprinkle const around 2022-11-16 19:14:42 -07:00
Behdad Esfahbod 561946c7d5 [layout] Comment 2022-11-16 17:59:29 -07:00
Behdad Esfahbod 2268207c19 [layout] Update comment 2022-11-16 17:51:22 -07:00
Behdad Esfahbod 658f8f4391 [layout] Comment 2022-11-16 17:50:35 -07:00
Behdad Esfahbod 27a8fe7d58 [layout] Only update buffer digest if buffer changed by a pause 2022-11-16 17:49:44 -07:00
Behdad Esfahbod 8b2a211123 [layout] Keep digest updated in the context
Don't recompute digest after every (applied) GSUB lookup.
2022-11-16 16:57:44 -07:00
Behdad Esfahbod a5964a2d2a [layout] Minor simplify 2022-11-16 16:45:23 -07:00
Behdad Esfahbod 80b8758881 [layout] Add a buffer message for digest-skipped lookups 2022-11-16 16:26:41 -07:00
Behdad Esfahbod afa71ee8ef Fix alignment error 2022-11-16 16:22:45 -07:00
Behdad Esfahbod dff1b809a0 [buffer] Add .digest() and use 2022-11-16 16:19:05 -07:00
Behdad Esfahbod 654a2eafc8 [layout] Use buffer-digest for GSUB as well
Combined with previous commit, this shows up to 12% speed up with
Roboto and the en-words (ie. short strings) benchmark, about 5%
for longer English tests, and no adverse effect on heavier fonts.
2022-11-16 16:13:52 -07:00
Behdad Esfahbod 15b6c32599 [layout] Use a buffer digest for GPOS to skip whole lookups 2022-11-16 16:11:36 -07:00
Behdad Esfahbod a053b84cb9 [gsubgpos] Optimize set-digest initialization
Previously we were once collecting set-digest for each subtable,
and another time for each lookup.

Now we compute the one for each lookup simply from the ones for
its subtables.
2022-11-16 14:39:25 -07:00
Behdad Esfahbod 20654cd889 [set-digest] Minor no logic change 2022-11-16 14:29:10 -07:00
Behdad Esfahbod 95b9763dbc [set-digest] Minor simplify 2022-11-16 14:15:01 -07:00
Behdad Esfahbod 9855b678f2 [cache] Minor rewrite assertion 2022-11-16 13:37:34 -07:00
Behdad Esfahbod a10ff20562 [ft] Comment 2022-11-16 13:34:37 -07:00
Behdad Esfahbod 557be9502a [test-vector] Fix test 2022-11-16 12:47:05 -07:00
Behdad Esfahbod 9027d15410 [test-iter] Fix leak 2022-11-16 12:39:30 -07:00
Behdad Esfahbod afd716d4cd [serialize] Don't free object-pool in reset() 2022-11-16 12:28:56 -07:00