Commit Graph

140 Commits

Author SHA1 Message Date
Behdad Esfahbod 70149885a7 [font] Towards implementing emboldening 2023-02-02 15:51:22 -07:00
Behdad Esfahbod 3e471bbc08 [vector] Better test 2023-01-04 11:53:49 -07:00
Behdad Esfahbod d8509061e6 [vector] It's okay if shrinking fails 2023-01-04 11:33:54 -07:00
Behdad Esfahbod b6be455020 [vector] Add resize_exact() 2023-01-02 18:05:43 -07:00
Behdad Esfahbod 9afe5f973e [vector] Fix leak
Discovered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54767
2023-01-02 11:46:45 -07:00
Behdad Esfahbod 55a7d81740 [vector] Allocate exact size in operator= 2023-01-01 23:07:42 -07:00
Behdad Esfahbod 449910d431 [vector] Allocate exact size in constructor 2023-01-01 19:27:10 -07:00
Behdad Esfahbod b87360763e [vector] Support shrinking storage if exact size provided
Only do it if requested size is less than quarter of allocated size.

This has massive benefit during CFF subset preprocessing.
2023-01-01 18:38:28 -07:00
Behdad Esfahbod 2eacc37e08 [vector] Add internal API for exact-size allocation
Use it from a couple of places.
2022-12-31 12:30:31 -07:00
Behdad Esfahbod 8e9e94dba9 Revert "[vector] Optimize grow_vector() for size"
This reverts commit 1dd9396c7a.

Is faster indeed.

15% on SourceHanSans/10000 benchmark.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod a66de336fb [vector] Minor use get_size() in as_bytes() 2022-12-01 14:32:13 -07:00
Behdad Esfahbod 7129b79406 [open-type] Add faster range-based loop to array types 2022-11-29 15:33:07 -07:00
Behdad Esfahbod 915c1a00cf [vector] Add remove_unordered
Saves 5% in NotoNastaliq/1000 subset benchmark.
2022-11-26 14:48:57 -07:00
Behdad Esfahbod 4b8d8fbee4 [ot-map] Micro-optimize for size 2022-11-26 14:31:15 -07:00
Behdad Esfahbod e333223f26 [array] Optimize serializing copy() 2022-11-25 14:26:02 -07:00
Behdad Esfahbod 7b197446ac [vector] Adjust for HB_OPTIMIZE_SIZE 2022-11-25 13:28:53 -07:00
Behdad Esfahbod d2a2f5bf4e [vector] Handroll copy 2022-11-25 12:44:02 -07:00
Behdad Esfahbod b0d2641186 [vector] Add "initialize" argument to resize() 2022-11-22 10:20:11 -07:00
Behdad Esfahbod 7cc79a8a86 [vector] Adjust comment 2022-11-21 12:09:24 -07:00
Behdad Esfahbod e82a3c69dd [array/vector] Optimize range-based for-loop
Avoid bounds-checking.
2022-11-21 12:00:10 -07:00
Behdad Esfahbod 2892fc71e8 [vector] Add std::move to pop()
This was removed in 76fc27713f,
but I believe that was faultly. It was because of a bad move
implementation in the set.
2022-11-18 18:03:59 -07:00
Behdad Esfahbod bef5a1c8dc [vector] Comment 2022-11-18 17:22:17 -07:00
Behdad Esfahbod 69b41f92ec [vector] Simplify shift_down_vector()
Compiler is smarter than I am.
2022-11-18 17:04:34 -07:00
Behdad Esfahbod 1dd9396c7a [vector] Optimize grow_vector() for size
Again, compiler is smarter than I am.
2022-11-18 17:01:14 -07:00
Behdad Esfahbod d36f688131 [vector] Optimize shrink_vector for size
Compiler is smarter than I am.
2022-11-18 17:00:07 -07:00
Behdad Esfahbod bc8eded296 [vector] Remove a for loop 2022-11-18 16:51:24 -07:00
Behdad Esfahbod afd9a58bd7 [vector] Save a couple hb_iter() invocations 2022-11-18 16:47:32 -07:00
Behdad Esfahbod f2b5db700f [vector] Remove .sub_array () 2022-11-16 21:22:57 -07:00
Behdad Esfahbod c7d57dcf26 [vector/array] Simplify qsort() 2022-11-16 21:21:31 -07:00
Behdad Esfahbod 4e618557a6 [vector] Don't subclass sorted vector from unsorted
Was doubling the size unnecessarily.
2022-11-13 17:23:25 -07:00
Behdad Esfahbod cddcb31065 [vector] Remove residual nullptr_t from when hashmap needed it 2022-07-12 13:15:38 -06:00
Behdad Esfahbod 30ba9a39e2 [vector] Add emplacing push implementation 2022-05-19 18:16:48 -06:00
Behdad Esfahbod a47b0aebf5 [vector] Fix remove() implementation
test-vector under valgrind happy now.
2022-05-19 15:52:16 -06:00
Behdad Esfahbod 6544fc284f [vector] Add further copy implementation 2022-05-19 15:43:15 -06:00
Behdad Esfahbod c19f116952 [meta] Remove non-existing gcc4 trait implementation 2022-05-19 15:43:15 -06:00
Behdad Esfahbod fb77f48ffd [vector] Optimize vector copy 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 544ffb913e [set] Adjust grow_vector condition 2022-05-19 15:43:15 -06:00
Behdad Esfahbod 14a24d8e3f [vector] Make hb_vector_t hashable 2022-05-19 13:04:06 -06:00
Thomas Devoogdt c657c4e1f8 [meta] fix type traits on gcc 4.9 #3526
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
2022-05-13 11:26:12 -06:00
Behdad Esfahbod 76fc27713f [vector] Remove explicit std::move
Was confusing compilers. Let them figure it out themselves.

Makes NotoNastaliqu subsetting/1000 benchmark more than twice faster:

Benchmark                                                                       Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_glyphs/NotoNastaliqUrdu-Regular.ttf/1000                    -0.5064         -0.5065           111            55           110            55
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/1000                -0.5494         -0.5493           132            59           131            59
2022-05-12 12:14:07 -06:00
Behdad Esfahbod 2e7f1ae48f [subset] Use vector.allocated size instead of tracking buf_size 2022-05-11 12:52:27 -06:00
Behdad Esfahbod 106388e766 [vector] Merge sorted-vector into vector
Was easier than I thought!

Let's see what the bot gods think...
2022-01-19 11:38:37 -07:00
Behdad Esfahbod 294d50ff35 [vector] Add sorted template argument 2022-01-19 11:32:14 -07:00
Behdad Esfahbod cd9799784c [vector] Remove old find() method 2022-01-19 11:14:25 -07:00
Behdad Esfahbod 6ef83c2c31 [vector] Remove .fini_deep() 2022-01-18 13:08:34 -07:00
Behdad Esfahbod 213e3f09b1 [vector] Add TODO Emplace? 2022-01-18 11:53:52 -07:00
Behdad Esfahbod 1198fb2468 [vector] Adjust construction criteria 2022-01-17 16:46:45 -07:00
Behdad Esfahbod c58bfa35fb [vector] Move semantics in vector remove() 2022-01-17 16:46:45 -07:00
Behdad Esfahbod 5946e945d5 [vector] Destruct in pop() 2022-01-17 16:46:45 -07:00
Behdad Esfahbod 7171917b52 [vector] Construct items when enlarging 2022-01-17 16:46:45 -07:00