Commit Graph

161 Commits

Author SHA1 Message Date
Behdad Esfahbod 5b50b07717 [subset-cff] Make BCD writing locale-independent 2023-02-19 20:39:01 -07:00
Behdad Esfahbod a4b7033d01 [cff2-subset] Blend Private values when instancing 2023-02-19 20:39:01 -07:00
Behdad Esfahbod f10a4c9d6a [cff] Rename encode_num to encode_num_cs 2023-02-19 20:39:01 -07:00
Behdad Esfahbod c65eb5a82e [cff] Specialize cff_private_dict_op_serializer_t for CFF1/2 2023-02-19 20:39:01 -07:00
Behdad Esfahbod bf4b34e87e [subset-cff2] Don't encode vsindex in Private dict 2023-02-19 20:39:01 -07:00
Behdad Esfahbod 82d9940a93 [subset-cff2] Don't encode vsindex if pinned 2023-02-19 20:39:01 -07:00
Behdad Esfahbod c632a164b9 [subset/cff] Support instancing 2023-01-06 11:01:25 -07:00
Behdad Esfahbod b6be455020 [vector] Add resize_exact() 2023-01-02 18:05:43 -07:00
Behdad Esfahbod a516ce97e0 [subset-cff] Add a few exact-allocation calls 2023-01-02 17:58:51 -07:00
Behdad Esfahbod 4a435dc024 [subset-cff] Remove an unlikely 2023-01-02 17:41:31 -07:00
Behdad Esfahbod f8c578fd93 [subset-cff] Remove commented-out line 2023-01-02 17:33:04 -07:00
Behdad Esfahbod 27531d853e [subset-cff] Move code around 2023-01-02 12:05:11 -07:00
Behdad Esfahbod 4f013c42f0 [subset-cff] Always compact charstrings
Reduces non-preprocessed subsetting memory footprint significantly.
2023-01-02 10:39:14 -07:00
Behdad Esfahbod 4dda1f7881 [cff-subset] Compact charstrings just after parsing
Massive peak-memory saving when processing face.
2023-01-01 19:00:04 -07:00
Behdad Esfahbod a7617c3cf1 [cff-subset] Drop hints just after parsing charstring
In prep for next commit.
2023-01-01 18:58:08 -07:00
Behdad Esfahbod 1119e60296 [subset-cff] Tweak another storage allocation 2023-01-01 18:31:32 -07:00
Behdad Esfahbod edb812345a [subset-cff] Another exact allocation 2022-12-31 13:55:41 -07:00
Behdad Esfahbod 0ec0214f10 [cff-subset] Adjust pre-allocation
Reduces memory use significantly.
2022-12-31 13:19:38 -07:00
Behdad Esfahbod 043eeb29a3 [subset-cff] Optimize encode_subrs
Don't loop over all original subrs. Just walk over closure subrs.
2022-12-02 13:58:36 -07:00
Behdad Esfahbod 0ad5977cd6 [subset-cff] Simplify hinting processing
We already have drop_hints in the params.
2022-12-02 13:41:36 -07:00
Behdad Esfahbod c947652768 [subset-cff] Micro-optimize 2022-12-02 12:01:35 -07:00
Behdad Esfahbod a5616227ca [subset-cff] Fix buffer size calculation 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 015af5a8e5 [subset-cff] Write a couple loops as range-based for 2022-12-02 12:01:35 -07:00
Behdad Esfahbod bfbbd4af25 [subset-cff] Copy str for call ops 2022-12-02 12:01:35 -07:00
Behdad Esfahbod c755b3884f [subset-cff] Pre-alloc enough for check-less copy 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 062e59ae67 [subset-cff] Optimize vector allocation for preprocessed input 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 2644540a74 [subset-cff] Compact parsed strings if using accelerator
Saves 32% on SourceHanSans/10000 benchmark!

Also, use memcmp now for writing out strings since now that our
ops are not super short, that's faster.

This makes cff-japanese test takes super long though; that needs
inspection.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod 32dd9810cf [subset-cff1] Cache glyph-to-sid-map in the accelerator
Benchmark                                                                                      Time             CPU      Time Old      Time New       CPU Old       CPU New
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/10                   -0.0841         -0.0843             0             0             0             0
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/64                   -0.1305         -0.1305             0             0             0             0
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/512                  -0.1398         -0.1401             1             1             1             1
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/4096                 +0.0382         +0.0380             9             9             9             9
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/10000                +0.0213         +0.0211            11            11            11            11
2022-11-30 14:00:33 -07:00
Garret Rieger 7551a668e3 [subset] Make cff_accelerator const.
This gives more confidence that it won't be accidentally modified by the subset operation using it.
2022-11-29 22:04:10 -07:00
Behdad Esfahbod 3ea0f37c30 [subset-cff] Move an init to constructor
The init was not called anyway.
2022-11-28 13:58:44 -07:00
Behdad Esfahbod 6c92c3e0cf [subset-cff] Remove unnecessary check 2022-11-28 13:54:24 -07:00
Behdad Esfahbod 7fd300dd9a [subset-cff] Use constructor for parsed_cs_op_t 2022-11-28 13:51:16 -07:00
Garret Rieger bd37900e0d [subset] use a reference to cached global/loca subrs.
Previously they were being copied in. Copying is no longer necessary now that hint dropping doesn't mutate the arrays.
2022-11-28 13:43:52 -07:00
Behdad Esfahbod ded9de9cd8 [cff] bsearch in fdselect
Saves 8% in NotoSansCJK / 10000 subset benchmark.
2022-11-28 13:32:08 -07:00
Behdad Esfahbod 0c33aba30c [subset-cff] Rename drop flag to hinting flag 2022-11-28 12:28:13 -07:00
Behdad Esfahbod 6f5b531986 [subset-cff] Make no-hinting use accelerator as well 2022-11-28 12:24:29 -07:00
Behdad Esfahbod f51a624e67 [subset-cff] Micro-optimize drop_hints_in_str 2022-11-27 14:54:39 -07:00
Behdad Esfahbod 3860326688 [subset-cff] Write loop more idiomatic 2022-11-27 13:23:13 -07:00
Behdad Esfahbod 3ff502d3ae [subset-cff] Remove unnecessary initialization 2022-11-27 12:58:04 -07:00
Behdad Esfahbod 6af4985bf9 [subset-cff] No need for bitflag here anymore 2022-11-26 18:20:20 -07:00
Behdad Esfahbod 69ce606d14 [subset-cff] Immediately drop subr numbers instead of marking for skip
Seems to work and saves ~2% time.
2022-11-26 18:18:35 -07:00
Behdad Esfahbod 1cf4f3e083 [subset-cff] More comment 2022-11-26 18:15:28 -07:00
Behdad Esfahbod f68221ff43 [subset-cff] Add comment 2022-11-26 18:12:14 -07:00
Behdad Esfahbod 048ab8a066 [subset-cff] Remove unused bits 2022-11-26 18:00:43 -07:00
Behdad Esfahbod 37cbfc0c7e [subset-cff] Remove unneeded member 2022-11-26 17:57:44 -07:00
Behdad Esfahbod 46ab15137b [subset-cff] Add has_calls to parsed charstrings
Optimize closure based on it.
2022-11-26 17:49:21 -07:00
Behdad Esfahbod 6d53074e63 [subset-cff] Drop another unused parameter 2022-11-26 17:23:09 -07:00
Behdad Esfahbod 42615561b5 Optimize a couple array references 2022-11-26 17:13:20 -07:00
Behdad Esfahbod 04d23b7ca8 [subset-cff] Micro-optimize collect_subr_refs_in_str 2022-11-26 17:08:00 -07:00
Garret Rieger a5d35fd80a [subset] use charstrings directly from accelerator cache if mutability isn't needed. 2022-11-25 16:50:55 -07:00