Commit Graph
19707 Commits
Author SHA1 Message Date
Behdad Esfahbod fa7b7fd888 Merge pull request #5570 from harfbuzz/alloc-pool-improvements
[alloc-pool] Implement alignment
2025-09-18 09:31:05 -06:00
Behdad Esfahbod e1fd2beeec [alloc-pool] Reduce memory usage by reclaiming some discards 2025-09-18 11:18:09 -04:00
Behdad Esfahbod a22add2530 [alloc-pool] Implement alignment 2025-09-18 11:04:06 -04:00
Behdad Esfahbod 08ff720042 [set] Speed up iterator 2025-09-18 10:57:43 -04:00
Behdad Esfahbod 230243378c [instancer/iup] Reduce mallocs again
Perhaps shrink() shouldn't default to realloc. Working on it.
2025-09-17 15:32:46 -04:00
Behdad Esfahbod 80a6f4b65e Merge pull request #5569 from harfbuzz/instancer-opt-more
Instancer opt more
2025-09-16 22:32:13 -06:00
Behdad Esfahbod 2be836c151 Revert "[instancer] Preallocate coordinate maps from alloc pool as well"
This reverts commit 3f71afe760.

Slowed things down.
2025-09-17 00:31:50 -04:00
Behdad Esfahbod 3f71afe760 [instancer] Preallocate coordinate maps from alloc pool as well 2025-09-17 00:26:40 -04:00
Behdad Esfahbod c03e1e0a7b [iup] Use a bit-page instead of bit-set
Reject large contours instead.
2025-09-16 23:51:19 -04:00
Behdad Esfahbod d4cc4823fa [instancer/tuplevar] Tune allocation size 2025-09-16 17:00:38 -06:00
Behdad Esfahbod 5b04b40dd5 [instancer/tuplevars] Allocate compiled_deltas from alloc pool 2025-09-16 16:52:53 -06:00
Behdad Esfahbod ea9b7de4ed [instancer/tuplevars] Allocate compiled_tuple_headers from alloc pool 2025-09-16 16:46:02 -06:00
Behdad Esfahbod bdac0aec2e [vector] Make shrink() useful in un-owned vectors 2025-09-16 16:42:32 -06:00
Behdad Esfahbod c2f2121527 [vector] Simplify allocate_from_pool / set_storage 2025-09-16 16:29:23 -06:00
Behdad Esfahbod 3ace032319 Merge pull request #5568 from harfbuzz/tuplevar-assignment-pool
[tuplevar] Use pool for assignment / copy construction
2025-09-16 11:17:29 -06:00
Behdad Esfahbod fb0ef230c9 Revert "[tuplevars] Allocate from pool"
This reverts commit 94d78de954.

Slowed things down.
2025-09-16 11:16:30 -06:00
Behdad Esfahbod 94d78de954 [tuplevars] Allocate from pool 2025-09-16 11:13:19 -06:00
Behdad Esfahbod f7e2d9a0f9 [alloc-pool] Tweak 2025-09-16 11:13:13 -06:00
Behdad Esfahbod f5fdf42615 [tuplevar] Use pool for duplicating 2025-09-16 10:45:33 -06:00
Behdad Esfahbod 53243ad27e Merge pull request #5567 from harfbuzz/tuplevalues-micro-opt
[tuplevalues] Speed up encoding
2025-09-16 02:15:21 -06:00
Behdad Esfahbod f9cd59ae41 [tuplevar] More use of pool 2025-09-16 01:45:36 -06:00
Behdad Esfahbod 12ce710f5c [tuplevar] Use alloc-pool instead of custom pool 2025-09-16 01:44:47 -06:00
Behdad Esfahbod 43e017f895 [tupledelta] Micro optimize 2025-09-16 01:31:21 -06:00
Behdad Esfahbod ebdeb2e30e [tuplevalues] Speed up encoding 2025-09-16 01:22:38 -06:00
Behdad Esfahbod 56e10f04f0 Merge pull request #5566 from harfbuzz/alloc-pool
Alloc pool
2025-09-16 01:02:12 -06:00
Behdad Esfahbod 755ed10915 Add hb-alloc-pool and use in gvar instancer 2025-09-16 00:43:29 -06:00
Behdad Esfahbod d6b080198e Rename hb-pool to hb-free-pool 2025-09-15 23:56:25 -06:00
Behdad Esfahbod e896575f70 Merge pull request #5565 from harfbuzz/vector-resize-simplify
[vector] Simplify resize()
2025-09-15 21:13:43 -06:00
Behdad Esfahbod 8237091363 [vector] Simplify resize() 2025-09-15 20:52:05 -06:00
Behdad Esfahbod a6aa981bf2 Merge pull request #5564 from harfbuzz/instancer-optimize-more2
[iup] Reuse more allocations
2025-09-15 20:23:28 -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
safoclandBehdad Esfahbod 43284d1f4d fix clang-format repeated flags (#5559)
* fix clang-format repeated flags

some flags were listed twice with opposite meanings

* Change AfterStruct formatting option to true

---------

Co-authored-by: Behdad Esfahbod <behdad@behdad.org>
2025-09-15 10:11:36 -06:00
Behdad Esfahbod b33f6fd213 Merge pull request #5555 from harfbuzz/instancer-gvar-micro-opts
Instancer gvar micro opts
2025-09-15 01:11: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