Commit Graph
196 Commits
Author SHA1 Message Date
Qunxin Liu e5139c51aa bug fix in hashmap get_with_hash() 2024-10-21 15:46:06 -06:00
Bruce Mitchener 3cfdbd6717 Use noexcept on swap, move constructors, etc. 2024-02-17 11:04:10 +01:00
Behdad Esfahbod 6a3ca37373 [map] Optimize storage
Such that population isn't a bitfield as we access it often.
2023-11-13 16:36:56 -07:00
Behdad Esfahbod d46cd93b6a [map] Speed up copy-constructor 2023-11-10 14:36:37 -07:00
Behdad Esfahbod e7879d6c55 [map] Micro-optimize destruction 2023-11-10 14:13:20 -07:00
Behdad Esfahbod 29d49eced8 [vector] Introduce realloc_moves tag
Some types (even aggregate) can be moved using realloc().
Extend the fast path to hb_hashmap and tuple_delta_t.
2023-11-01 15:55:47 -06:00
Behdad Esfahbod 7cb7a7999b [map] Fix undefined integer-overflow
Fixes https://oss-fuzz.com/testcase-detail/5814850435284992
2023-09-28 09:24:43 -06:00
inobelar 69da5aae02 Added minor fixes to build without errors with gcc 4.9.2 2023-09-23 11:54:01 -06:00
Behdad Esfahbod 06ff3bcb8d [COLR,glyf] Use map instead of set for tracking current glyphs / layers 2023-08-15 14:41:18 -06:00
Behdad Esfahbod 5690840ceb [map] Another try at fixing archaic clang
Fixes (?) https://github.com/harfbuzz/harfbuzz/issues/4138
2023-07-26 09:54:15 -06:00
Behdad Esfahbod 1fc128f609 Replace a few memset/memcpy's with hb_ equivalents 2023-06-26 18:36:23 -06:00
Behdad Esfahbod 393f0f9f16 [map] Rename resize() to alloc()
Better matches the functionality, and hb_vector_t.
2023-06-25 18:14:56 -06:00
Behdad Esfahbod be0cec288b [map] Micro-optimize iteration
Make is_real() faster (removes a shift). is_used() gets inlined
so is not slowed down by this change.
2023-06-25 16:01:13 -06:00
Behdad Esfahbod 1902f6ccbb [map] Inline an accessor function 2023-06-23 13:21:21 -06:00
Behdad Esfahbod 43d2ced841 [map] Minor remove a conditional 2023-06-23 13:16:51 -06:00
Behdad Esfahbod 817236dcb8 [map] Speed up is_real 2023-06-23 13:12:40 -06:00
Behdad Esfahbod cb5f4d0c68 [subset-plan] Avoid a copy in freeing name-table-overrides 2023-06-22 18:56:17 -06:00
Behdad Esfahbod 280edb909b [map] Use a variable instead of function for is_trivial 2023-06-22 17:07:31 -06:00
Behdad Esfahbod 0aa939e70f [map] Add a constexpr 2023-06-22 17:05:55 -06:00
Behdad Esfahbod cf386e8ce2 [map] Speed up resize() 2023-06-22 17:02:10 -06:00
Behdad Esfahbod 0f0b3bee21 [map] Fix use-after-move issue 2023-06-08 11:13:33 -06:00
Behdad Esfahbod e0b60bd08d [subset/cff1] Speed up remap_sids 2023-06-07 17:25:47 -06:00
Behdad Esfahbod 0364c69e6d [iter] Add has_fast_len
Set iterators are not random_access, but have fast len().
2023-06-07 15:52:18 -06:00
Behdad Esfahbod cc9651d55d [map] Micro-optimize 2023-06-07 12:20:48 -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 c6368e014d [map] Return const reference from operator()
Like we do in operator[].
2023-06-01 20:51:17 -06:00
Behdad Esfahbod 4a93576bca Revert "[map] Speedup for int types"
This reverts commit c1b75f5ff0.

I was seeing very long chains (140) and a 17% slowdown in
BM_subset/subset_codepoints/RobotoFlex-Variable.ttf/512

Bummer.
2023-05-28 13:24:02 -06:00
Behdad Esfahbod c1b75f5ff0 [map] Speedup for int types
Since our int hash is now good, we don't need the modulo prime
here, so forgo it.  Major speedup:

Comparing before to after
Benchmark                              Time             CPU      Time Old      Time New       CPU Old       CPU New
-------------------------------------------------------------------------------------------------------------------
BM_MapInsert/16                     -0.4136         -0.4137             6             4             6             4
BM_MapInsert/64                     -0.4442         -0.4441             6             3             6             3
BM_MapInsert/512                    -0.5382         -0.5383             8             4             8             4
BM_MapInsert/4096                   -0.4160         -0.4162             8             5             8             5
BM_MapInsert/32768                  -0.3256         -0.3258            12             8            12             8
BM_MapInsert/262144                 -0.1723         -0.1727            11            10            11             9
BM_MapInsert/1048576                -0.2310         -0.2309            28            22            28            22
BM_MapLookup/16                     -0.0247         -0.0247             3             3             3             3
BM_MapLookup/64                     -0.1039         -0.1038             3             3             3             3
BM_MapLookup/512                    -0.1076         -0.1079             4             3             4             3
BM_MapLookup/4096                   -0.3729         -0.3732             9             6             9             6
BM_MapLookup/32768                  +0.2467         +0.2468             9            12             9            12
BM_MapLookup/262144                 -0.1862         -0.1868            14            11            14            11
BM_MapLookup/1048576                +0.1159         +0.1160            15            17            15            17
OVERALL_GEOMEAN                     -0.2414         -0.2416             0             0             0             0
2023-05-28 13:03:04 -06:00
Behdad Esfahbod 5abe713203 [map] Resize map on long chain probes 2023-05-27 00:49:20 +02:00
Behdad Esfahbod 2655b7607c [map] Micro-optimize
This shows a speedup.
2023-05-23 10:57:58 -06:00
Behdad Esfahbod 12b0680e60 [map] Fix set()
This was broken in 2133aa2407.

We have to keep probing over tombstones.
2023-05-23 10:49:41 -06:00
Behdad Esfahbod 0270e3e974 [map] Reinstate quadratic probing 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 19b628bdf0 Revert "[map] Implement Robinhood hashing"
This reverts commit 705617856818056a44a627f340c91e335c57f310.
2023-05-16 10:12:02 +02:00
Behdad Esfahbod 18c3ba5018 [map] Implement Robinhood hashing
Numbers are not improved though. :(
2023-05-16 10:12:02 +02:00
Behdad Esfahbod 2133aa2407 [map] Inline code for set() 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 5bf5188ea2 [map] Simplify del() 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 2ffec3a6f4 [map] Shuffle fetch_item 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 1dc99128b9 [map] Separate has() code from set() code 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 2dd0803c85 [map] Downgrade from quadratic to linear probing 2023-05-16 10:12:02 +02:00
Behdad Esfahbod 498197671a [map] Write get() in terms of has() 2023-05-16 10:12:02 +02:00
Behdad Esfahbod b7a8d23bc8 [map] Micro-optimize for hb_map_t 2023-05-08 14:32:24 -06:00
Behdad Esfahbod a2efa5b489 [map] Another try at fixing old Mac build
https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-03 09:15:46 -07:00
Behdad Esfahbod be64cae164 [map] Another try at fixing old Mac builds
Maybe fixes https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-02 09:50:38 -07:00
Behdad Esfahbod 67e01c1292 [map] Try to work around old Mac compiler bug
Maybe fixes https://github.com/harfbuzz/harfbuzz/issues/4138
2023-03-01 20:08:17 -07:00
Behdad Esfahbod 8206569d63 [map] Remove hashmap create/destroy/vtable
Unused now.
2023-01-11 13:24:50 -07:00
Behdad Esfahbod 9420966f5b [map] Fix next() 2023-01-05 10:17:24 -07:00
Behdad Esfahbod 35f46e74d1 [map] Add hb_map_keys() and hb_map_values() 2023-01-04 17:12:08 -07:00
Behdad Esfahbod 4f6079138d [map] Add hb_map_update() 2023-01-04 13:58:46 -07:00