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
Behdad Esfahbod
74acf52f33
[subset-cff] Micro-optimize copy_str more
2022-11-25 14:43:44 -07:00
Behdad Esfahbod
d2f3cde7ef
[subset-cff] Micro-optimize copy_str
2022-11-25 14:38:30 -07:00
Behdad Esfahbod
22990fca1d
Merge pull request #3894 from googlefonts/cff_accel
...
[subset] Cache parsed char strings in CFF accelerator
2022-11-25 14:12:58 -07:00
Garret Rieger
8d5c899b0f
[subset] In cff accelerator hold reference to CFF table instead of the whole font.
2022-11-25 20:53:20 +00:00
Garret Rieger
75a99f28ab
[subset] destruct cff accelerator if present.
2022-11-25 20:24:05 +00:00
Behdad Esfahbod
1d474194f0
[subset-cff] Micro-optimize encode_str
2022-11-25 13:21:35 -07:00
Behdad Esfahbod
3c4a610b59
[subset-cff] Micro-optimize copy_str some more
2022-11-25 13:16:30 -07:00
Behdad Esfahbod
535aadb309
[subset-cff] Micro-optimize collect_subr_refs_in_str more
2022-11-25 13:07:42 -07:00
Behdad Esfahbod
00a9df3a43
[subset-cff] Micro-optimize collect_subr_refs_in_str
2022-11-25 13:05:05 -07:00
Garret Rieger
71c23c1c07
[subset] don't copy the entire global/loca subr lists from the accelerator.
...
Instead run a closure on the retained charstrings and copy only the referenced subrs. This significantly speeds up cases with small character sets.
2022-11-25 18:05:39 +00:00
Garret Rieger
4ff09274a8
[subset] In CFF accelerator keep a reference to original face.
...
The charstring objects reference memory from the original face so we need to maintain a reference to prevent it from being destroyed.
2022-11-24 22:47:29 +00:00