Commit Graph
15354 Commits
Author SHA1 Message Date
Behdad Esfahbod 8237091363 [vector] Simplify resize() 2025-09-15 20:52:05 -06:00
Behdad Esfahbod c56ef9ed89 [instancer] Reuse more allocations
These allocs are scratched. Don't free them, so we reuse.
2025-09-15 20:10:54 -06:00
Behdad Esfahbod 8e3e8c66e1 [iup] Reuse more allocations 2025-09-15 19:50:04 -06:00
Behdad Esfahbod bac2a67cc9 Merge pull request #5563 from harfbuzz/instancer-gvar-consolidate-mallocs
Instancer gvar consolidate mallocs
2025-09-15 19:30:46 -06:00
Behdad Esfahbod 82ca73a2c3 [iup] Reuse more vector allocs 2025-09-15 19:12:40 -06:00
Behdad Esfahbod e42714cfff [iup] Reuse bit-set allocs 2025-09-15 19:05:38 -06:00
Behdad Esfahbod 54ac33cce1 [iup] Reuse more mallocs 2025-09-15 19:01:53 -06:00
Behdad Esfahbod 045bd69103 [iup] Use bit-set instead of set 2025-09-15 18:56:55 -06:00
Behdad Esfahbod 5e816ef7ae [iup] Reuse vectors 2025-09-15 18:54:10 -06:00
Behdad Esfahbod a64ab6c6e5 [iup] Reduce hb_set_t allocs 2025-09-15 17:47:07 -06:00
Behdad Esfahbod 5928a3c738 [iup] Reduce vector allocs 2025-09-15 17:20:43 -06:00
Behdad Esfahbod df18518f62 [iup] Don't sqrt 2025-09-15 17:14:31 -06:00
Behdad Esfahbod db86e546ab [instancer/gvar] Combine peak_coords mallocs into one chunk 2025-09-15 16:46:32 -06:00
Garret Rieger 54ab8f0df4 [repacker] make repacker object ids stable.
Prior to this change the object id for a vertex in the repacker graph is it's position in the topological ordering. As a result after each sorting the object ids change. This decouples the topological sorting from the object id assignments. A separate ordering list is retained. This simplifies handling around object ids which no longer needs to account for them shifting, and improves performance by eliminating the step of reassigned link object ids after each sort.
2025-09-15 16:34:44 -06:00
Behdad Esfahbod 26cc735551 [vector] Remove a comment 2025-09-15 15:49:36 -06:00
safocl 9d0045443d Fix invalid reinterpret_cast (#5558)
* Fix invalid reinterpret_cast

reinterpret_cast from non-atomic object to atomic object is not valid.

https://eel.is/c++draft/atomics.types.generic#general-3
>[Note 2: The representation of an atomic specialization
>need not have the same size and alignment requirement as
>its corresponding argument type. — end note]

https://eel.is/c++draft/basic.compound#5
>5 Two objects a and b are pointer-interconvertible if
>(5.1) they are the same object, or
>(5.2) one is a union object and the other is a non-static
>data member of that object ([class.union]), or
>(5.3) one is a standard-layout class object and the other
>is the first non-static data member of that object or any
>base class subobject of that object ([class.mem]), or
>(5.4) there exists an object c such that a and c are
>pointer-interconvertible, and c and b are pointer-interconvertible.
>If two objects are pointer-interconvertible, then they have
>the same address, and it is possible to obtain a pointer
>to one from a pointer to the other via a reinterpret_cast
>([expr.reinterpret.cast]).

objects of types `int` and `std::atomic<int>` are not
pointer-interconvertible (an object of type `int` is not
first non-static data member of `std::atomic<int>`)

https://eel.is/c++draft/basic.lval#11
>11 An object of dynamic type T-obj is type-accessible through
>a glvalue of type T-ref if T-ref is similar ([conv.qual]) to:
>(11.1) T-obj,
>(11.2) a type that is the signed or unsigned type corresponding
>to T-obj, or
>(11.3) a char, unsigned char, or std::byte type.
>If a program attempts to access ([defns.access]) the stored
>value of an object through a glvalue through which it is not
>type-accessible, the behavior is undefined

The original code resulted in undefined behavior.

* revert code formatting

* fix const qualifier in type for atomic operation.

* implement copy and move ctors (assignment-operators) and swap functions.

* swap-functions replaced as frendly members, common header includes returned.

* add HB_ prefix to defined macro.

* some formatting.
2025-09-15 14:16:30 -06:00
Behdad Esfahbod e310f81129 [instancer/gvar] Speed up hash lookup-set 2025-09-15 00:58:07 -06:00
Behdad Esfahbod 7a57c3c192 [instancer/gvar] Simplify sorting 2025-09-15 00:52:50 -06:00
Behdad Esfahbod b51ea43693 [gvar] Micro-opt instancing 2025-09-15 00:44:49 -06:00
Behdad Esfahbod 4d59019935 [instancer/tuplevar] Allocate intermediates array on demand 2025-09-14 18:14:03 -06:00
Behdad Esfahbod 35212ba3ea [gvar] Change a storage type
No functional change.
2025-09-14 17:53:25 -06:00
Behdad Esfahbod 20457df527 [map] Tune for small maps 2025-09-14 16:17:34 -06:00
Behdad Esfahbod 323901f8db [instancer/tuplevars] Reduce work by combining two loops 2025-09-14 15:38:27 -06:00
Behdad Esfahbod eb6de66469 [instancer/tuplevars] Reduce work 2025-09-14 13:13:22 -06:00
Behdad Esfahbod 90ea408e47 [map] Speed up copying of trivially-assignable types 2025-09-13 23:20:58 -06:00
Behdad Esfahbod fd282dcfe7 [map] Speed up operator= for trivial item types 2025-09-13 17:56:34 -06:00
Behdad Esfahbod 1f936e2366 [instancer] Try to move instead of copy some tuples 2025-09-13 17:04:39 -06:00
Behdad Esfahbod 2319d763aa [TupleValues] Micro-optimize encoding
Also, a check for 32bit values in the word-encoding function
was missing. Ouch.
2025-09-13 16:21:34 -06:00
Behdad Esfahbod f2c4ab4545 [instancer/varstore] Micro-optimize 2025-09-13 16:14:55 -06:00
Behdad Esfahbod b97369bbe8 Merge pull request #5549 from harfbuzz/instancer-varstore-optimize-compromise
[instancer/varstore] Only optimize instanced varstore incrementally
2025-09-13 14:10:20 -06:00
Behdad Esfahbod cf6c9d8a8f [instancer/varstore] Put back sort again
In testing with GoogleSansFlex, this produces slightly smaller
result.
2025-09-13 13:51:50 -06:00
Behdad Esfahbod c7e46ab2bf [instancer/varstore] Avoid copies in loops 2025-09-13 12:54:18 -06:00
Behdad Esfahbod 7a430de326 Add -Wpessimizing-move warning
Part of https://github.com/harfbuzz/harfbuzz/issues/5550
2025-09-13 00:08:10 -06:00
Behdad Esfahbod a4a5089201 [instancer/varstore] Speed up encoding merging
Don't recalculate chars from all row data.
2025-09-12 23:41:40 -06:00
Behdad Esfahbod f0a1289a6a [instancer/varstore] Massage optimizer a bit 2025-09-12 19:25:57 -06:00
Behdad Esfahbod a878dca00f [instancer/varstore] Remove sorting from the optimizer
Just work with incoming order.
2025-09-12 19:19:07 -06:00
Behdad Esfahbod e16be51549 [instancer/varstore] Only optimize instanced varstore incrementally
See comments. This basically wipes of the varstore optimization
costs out of the profiles, which saves eg. 25% total time in
GoogleSansFlex instantiation, with practically no file size
downside.
2025-09-12 18:01:09 -06:00
Behdad Esfahbod a4087e7f7a [instancer/varlib] Minor non-functional change 2025-09-12 17:02:42 -06:00
Behdad Esfahbod d8c1bce273 [instancer/varstore] Mark a function HOT 2025-09-12 14:39:54 -06:00
Garret Rieger aa58b43de4 [subset] Introduce HB_SUBSET_FLAGS_RETAIN_NUM_GLYPHS. (#5547)
Used in conjunction with retain gids, when set the num glyphs from the input font will be preserved. Empty glyphs will be inserted as necessary to maintain the num glyphs value. Put under experimental for now.
2025-09-12 14:24:41 -06:00
Behdad Esfahbod bf8929fbfb 11.5.0 2025-09-12 13:32:38 -06:00
Behdad Esfahbod 74c318610d [rust] Update to HarfRust 0.3.0 (#5548) 2025-09-12 13:31:29 -06:00
Behdad Esfahbod 3965e9a64b [instancer/varstore] Change sort key (#5540)
See https://github.com/harfbuzz/harfbuzz/pull/5540
2025-09-12 13:12:05 -06:00
Behdad Esfahbod c9480db91b [instancer/varstore] Add a heuristic to speed up optimization 2025-09-12 12:51:26 -06:00
David Corbett dce73766f5 [Unicode 17] Update the script direction list 2025-09-12 12:00:48 -06:00
Behdad Esfahbod 0f1dab0f93 [instancer/varstore] More gain_from_merging optimization (#5543)
* [instancer/varstore] More gain_from_merging optimization

* [tests] Re-enable a test that was disabled until an issue fixed

See comment.
2025-09-12 11:43:21 -06:00
Behdad Esfahbod e4957b0cd2 [varLib/instancer] Simplify gain encoding 2025-09-12 10:57:49 -06:00
Behdad Esfahbod 20d7ef5f63 [instancer/varstore] Change gain encoding
gain can be high in theory.
2025-09-12 10:45:08 -06:00
Behdad Esfahbod ca9a8aba5e Revert "[instancer/varstore] Micro-optimize"
This reverts commit 7484eb5807.
2025-09-12 03:50:46 -06:00
Behdad Esfahbod f12be45c3d [instancer/varstore] Optimize gain comparisons 2025-09-12 03:42:49 -06:00