Commit Graph

125 Commits

Author SHA1 Message Date
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
Garret Rieger a3afa61ce8 [subset] use cached parsed char strings if available. 2022-11-24 21:14:00 +00:00
Garret Rieger 47c125845c [subset] Cache parsed charstrings in the cff accelerator. 2022-11-24 21:14:00 +00:00
Garret Rieger 48b6837074 [subset] add a CFF specific accelerator object.
This allows CFF specific accelerator structures to be isolated to the CFF code.
2022-11-24 21:13:59 +00:00
Behdad Esfahbod d77f346d1a [subset-cff] Minor rename 2022-11-24 14:02:46 -07:00
Behdad Esfahbod 29a0fa089a [subset-cff] Micro-optimize 2022-11-24 14:00:59 -07:00
Behdad Esfahbod 0bf7d9eb4d [subset-cff] Micro-optimize encode_byte 2022-11-23 13:20:48 -07:00
Behdad Esfahbod a23f820427 [subset-cff] Micro-optimize array access 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod c53c648127 [subset-cff] Another handrolled memcpy 2022-11-22 12:46:25 -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 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 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
Garret Rieger 98aaecd397 [subset] fix data race touching Crap() in cff subsetting. 2022-06-01 22:50:35 +01:00
Behdad Esfahbod e91863b717 [subset-cff] Pre-size map in subr_remap_t::create() 2022-05-18 12:39:55 -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