Behdad Esfahbod
4d4792ce3d
[subset/hdmx] Speed up more for retaingids
2023-06-03 20:34:51 -06:00
Behdad Esfahbod
a3f7ed709b
[subset/hdmx] Don't clear memory unnecessarily
2023-06-03 20:25:14 -06:00
Behdad Esfahbod
e263c3ccbb
[subset/hdmx] Speed up
2023-06-03 20:20:57 -06:00
Behdad Esfahbod
0e16be9b2c
[subset-plan] Reuse glyph_for_gid result
2023-06-03 19:45:44 -06:00
Behdad Esfahbod
590fb3529a
[subset] Reduce memory pressure
2023-06-03 19:21:22 -06:00
Behdad Esfahbod
c03c300016
[subset] Tweak memory allocation
...
Reduces chances of rework, specially for glyf table if padding
is needed...
2023-06-03 19:05:10 -06:00
Behdad Esfahbod
38fa032330
Revert "[subset/loca] Build in the serializer memory"
...
This reverts commit 546b518186 .
2023-06-03 18:51:09 -06:00
Behdad Esfahbod
546b518186
[subset/loca] Build in the serializer memory
...
Because it's hot. Doesn't seem to speed up though. Slight
slowdown. Going to revert.
2023-06-03 18:50:35 -06:00
Behdad Esfahbod
3cb2b49e61
[subset/loca] Shuffle code around
2023-06-03 18:45:20 -06:00
Behdad Esfahbod
f014112d16
Revert "[subset] Allow adding table directly from subset()"
...
This reverts commit 25a6514887 .
2023-06-03 18:27:24 -06:00
Behdad Esfahbod
25a6514887
[subset] Allow adding table directly from subset()
...
And do it for hmtx. Going to revert since it slows things down.
Apparently the serializer buffer is in caches and hot, so faster
to write to and copy even.
2023-06-03 18:26:36 -06:00
Behdad Esfahbod
b0d0babb2e
[subset/loca] Rewrite loop faster
2023-06-03 17:14:55 -06:00
Behdad Esfahbod
8dab444102
[subset/hmtx] Micro-optimize last commit
...
hb_zip has its own overhead...
2023-06-03 17:06:30 -06:00
Behdad Esfahbod
e981dc24c8
[subset/hmtx] Rewrite loop faster for retaingid
2023-06-03 17:04:00 -06:00
Behdad Esfahbod
4a9da02619
[subset/hmtx] Micro-optimize
2023-06-03 16:46:29 -06:00
Behdad Esfahbod
6a3fcc64f3
[map] Don't call hash() if map is empty
2023-06-03 16:39:55 -06:00
Behdad Esfahbod
735d249639
[map] Remove an unlikely
...
Empty maps are common in some subsetting operations.
2023-06-03 16:35:03 -06:00
Behdad Esfahbod
ca27925d55
Use hb_codepoint_pair_t in more places
2023-06-03 16:18:15 -06:00
Behdad Esfahbod
841e86fd98
[subset/hmtx] Further speedup!
2023-06-03 16:09:45 -06:00
Behdad Esfahbod
de729ec105
[meta] Return reference from reference-wrapper
2023-06-03 15:48:54 -06:00
Behdad Esfahbod
c7493efeaf
[subset/loca] Micro-optimize
2023-06-03 15:39:27 -06:00
Behdad Esfahbod
13a4c7b3d3
[subset/hmtx] Comment
2023-06-03 15:12:53 -06:00
Behdad Esfahbod
4da2996fe2
[doc] Fix
2023-06-03 15:08:20 -06:00
Behdad Esfahbod
c3e7f45166
Add HB_CODEPOINT_INVALID
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/4262
2023-06-03 14:56:47 -06:00
Behdad Esfahbod
efefec13cc
[subset/glyf] Remove unneeded codepath
2023-06-02 20:33:52 -06:00
Behdad Esfahbod
ac1f5ca0d9
[subset/loca] Micro-optimize
2023-06-02 17:07:44 -06:00
Behdad Esfahbod
6eae932566
[subset/loca] Reduce a vector allocation
2023-06-02 17:05:27 -06:00
Behdad Esfahbod
cd249d2364
[subset/hmtx] Micro-optimize
2023-06-02 16:15:05 -06:00
Behdad Esfahbod
ec8965e432
[subset/glyf] Don't clear loca allocation
2023-06-02 16:10:25 -06:00
Behdad Esfahbod
916629d182
[subset/hmtx] Don't clear allocation
2023-06-02 16:08:49 -06:00
Behdad Esfahbod
24b069cd53
[subset] Pre-alloc a few maps
2023-06-02 15:55:53 -06:00
Behdad Esfahbod
7319d0d712
[subset-plan] Add a couple of map pre-allocations
...
Approximate...
2023-06-02 15:41:47 -06:00
Behdad Esfahbod
76904b0423
[subset-plan] Simplify / speedup planning glyphset
2023-06-02 15:30:12 -06:00
Behdad Esfahbod
965ce7bba4
[subset-plan] Speed up planning new_to_old_gid_list
2023-06-02 15:24:00 -06:00
Behdad Esfahbod
b67e464b1c
[subset/retaingid] Regain perf lost
...
In 0f12fd5a66
2023-06-02 15:11:06 -06:00
Behdad Esfahbod
0f12fd5a66
[subset/glyf] Fix for non-monotonic glyphmap
...
Slows things down again, but is correct. Still a good win
combined with the previous changes.
2023-06-02 13:58:55 -06:00
Behdad Esfahbod
66ce902c3a
[glyf] Reduce allocation again
2023-06-02 13:53:21 -06:00
Behdad Esfahbod
0e0110e7f2
[glyf] Avoid a SubsetGlyph copy
...
Unfortunately hb_second() always does a copy...
2023-06-02 13:34:58 -06:00
Behdad Esfahbod
33ea8b5e5d
[subset/glyf] Don't allocate empty SubsetGlyf's
...
Shows 33% speedup on Mplus/retaingid/10 benchmark:
Comparing before to after
Benchmark Time CPU Time Old Time New CPU Old CPU New
--------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/10 -0.3296 -0.3294 0 0 0 0
2023-06-02 13:28:07 -06:00
Garret Rieger
ad872e2313
[subset] Optimize hmtx/vmtx serialization.
...
Make serializer allocation up front to avoid bounds checking overhead for each metric.
Benchmarks:
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/10_median -0.1005 -0.1005 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/64_median -0.0693 -0.0692 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/512_median -0.0294 -0.0293 1 1 1 1
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/4096_median -0.0033 -0.0032 3 3 3 3
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/10000_median +0.0170 +0.0171 7 7 7 7
2023-06-02 12:41:44 -06:00
Behdad Esfahbod
c6368e014d
[map] Return const reference from operator()
...
Like we do in operator[].
2023-06-01 20:51:17 -06:00
Behdad Esfahbod
b04ca1c188
Revert "[subset/glyf] Exact allocation"
...
This reverts commit a830f085c8 .
Weirdly enough in a benchmark I'm running I see this show
some slowdown. Makes zero sense.
2023-06-01 20:43:07 -06:00
Behdad Esfahbod
a830f085c8
[subset/glyf] Exact allocation
2023-06-01 20:41:46 -06:00
Behdad Esfahbod
ff0b85cf57
[subset/glyf] Empty .notdef only if old-gid was also 0
...
Otherwise it wasn't a .notdef, even if new-gid is 0.
2023-06-01 20:30:56 -06:00
Behdad Esfahbod
65a7d8c6f0
[glyf] Empty glyphs need no padding
2023-06-01 20:20:00 -06:00
Behdad Esfahbod
73c18d1d42
[glyf] Micro-optimize padded_offsets
2023-06-01 20:11:22 -06:00
Behdad Esfahbod
88d8a6d69f
[BEInt] Use packed-int trick for writing as well
2023-06-01 19:49:44 -06:00
Behdad Esfahbod
4d853b8ba6
[subset/regaingid/glyf] Add a fastpath for empty glyphs
...
Mplus benchmark:
Comparing before to after
Benchmark Time CPU Time Old Time New CPU Old CPU New
-----------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/10 -0.1764 -0.1771 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/64 -0.1394 -0.1394 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/512 -0.0644 -0.0645 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/4096 +0.0132 +0.0131 1 1 1 1
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/retaingids/10000 -0.0029 -0.0034 3 3 3 3
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/10 +0.0364 +0.0362 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/64 +0.0346 +0.0343 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/512 +0.0271 +0.0268 0 0 0 0
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/4096 +0.0193 +0.0193 1 1 1 1
BM_subset/subset_glyphs/Mplus1p-Regular.ttf/10000 -0.0240 -0.0243 2 2 2 2
OVERALL_GEOMEAN -0.0305 -0.0307 0 0 0 0
2023-06-01 19:24:36 -06:00
Behdad Esfahbod
6ec7629fba
[subset/glyf] Add a const
2023-06-01 18:18:30 -06:00
Behdad Esfahbod
9f54ab922f
[subset-plan] Keep a reverse-gid vector
...
To speed up iteration.
2023-06-01 18:07:59 -06:00