Commit Graph

52 Commits

Author SHA1 Message Date
Garret Rieger 8d8bcde8cf [set] don't allow -1 (HB_SET_VALUE_INVALID) to be inserted into a hb_set_t.
Add tests that check all of the addition methods.
2023-03-15 12:10:18 -06:00
Behdad Esfahbod 207ae11ab9 [set] Allocate first page exact 2023-01-05 14:08:47 -07:00
Behdad Esfahbod 45fc919a10 [bit-set] Minor setting length on allocation failure 2023-01-04 11:35:44 -07:00
Behdad Esfahbod 6c272b920d [set] Don't discard allocation in operator=
That had caused memory thrashing.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54789
2023-01-03 13:00:41 -07:00
Behdad Esfahbod 8f2345ca36 Use more vector resize_exact 2023-01-02 18:08:45 -07:00
Behdad Esfahbod 54dd01b865 [set] Use exact-allocation in copying
Significantly reduces memory consumption.
2022-12-31 13:33:40 -07:00
Behdad Esfahbod 0c6a721337 [set] Another exact-size allocation 2022-12-31 12:42:29 -07:00
Behdad Esfahbod 1bd386515c [bit-set] Micro-optimize page_for 2022-12-04 12:30:20 -07:00
Behdad Esfahbod b182e2808a [bit-set] Don't clear pages when copying set 2022-12-04 12:22:17 -07:00
Behdad Esfahbod d2a2670e54 [iter] Simplify has() interface implementations 2022-11-28 19:43:09 -07:00
Behdad Esfahbod 9df06a2695 [bit-set] Fix is_subset() short-circut criteria
Ouch!
2022-11-26 14:56:45 -07:00
Behdad Esfahbod 03d64b7469 [bit-set] Remove TODO that would never happen 2022-11-24 14:33:18 -07:00
Behdad Esfahbod 690df8a369 [bit-set] Micro-optimize prev() 2022-11-24 14:32:51 -07:00
Behdad Esfahbod fe5d9176ae [bit-set] Micro-optimize size
It's silly that this saves size at all. :(
2022-11-24 14:30:18 -07:00
Behdad Esfahbod cf9b9929df [bit-set] Micro-optimize process() 2022-11-24 14:26:28 -07:00
Behdad Esfahbod d77903db7b [bit-set] Micro-optimize 2022-11-24 14:22:32 -07:00
Behdad Esfahbod 13dd4b464b [bit-set] Micro-optimize access 2022-11-24 14:20:42 -07:00
Behdad Esfahbod f73c15ca6c [atomic-int] Add operators for relaxed ops 2022-08-03 13:01:04 -06:00
Behdad Esfahbod e5f0bc8f0a [set] Save a few kilobytes via type erasure of process() 2022-07-13 13:22:34 -06:00
Behdad Esfahbod e2aa29907d [set] Use relaxed atomic ops for last_page_index
Since iterating a set from multiple threads is supported.
2022-05-27 07:06:02 -06:00
Behdad Esfahbod f1bf14ea89 Revert "[set] Cache hash value"
This reverts commit 44952bcc25.

While we investivate https://github.com/harfbuzz/harfbuzz/issues/3599
2022-05-19 16:49:27 -06:00
Behdad Esfahbod 58f848daa8 [set/map] Adjust hash function return type 2022-05-19 15:43:19 -06:00
Behdad Esfahbod 28b44ac46a [set] Switch set copy to vector operator =
Slows it down currently.
2022-05-19 15:43:15 -06:00
Behdad Esfahbod 44952bcc25 [set] Cache hash value 2022-05-19 14:02:48 -06:00
Behdad Esfahbod 844ac328e4 [set] Fix hb_set_t hash stability 2022-05-19 13:54:31 -06:00
Behdad Esfahbod 124f9aeb9b [set] Make hb_set_t hashable 2022-05-19 12:58:02 -06:00
Behdad Esfahbod 1f578b5a32 [set] Add pre-allocation internal API 2022-05-18 15:25:00 -06:00
Behdad Esfahbod 067225a86d [set] Optimize const page_for() using last_page_lookup caching
Similar to previous commit.

This speeds up SetLookup benchmark by 50%, but that's because that
lookup always hits the same page...
2022-04-29 13:04:36 -06:00
Behdad Esfahbod c283e41ce3 [set] Optimize non-const page_for() using last_page_lookup caching
This speeds up SetOrderedInsert tests by 15 to 40 percent, and the
subset_mplus1p benchmarks by 9 to 27 percent.
2022-04-29 12:45:48 -06:00
Behdad Esfahbod 0a38878549 [set] Minor touch-up on the previous commit 2022-03-25 09:42:36 -06:00
Andrew John 0182988229
[set] Add call to export set contents to an array. (#3500)
[set] Add hb_set_next_many.
2022-03-25 09:36:44 -06:00
Andy John ef588ea97b Add option to insert a sorted arrays of values to sets. 2022-03-21 15:32:59 -06:00
Andy John 7a1e79c3ba Fix typo. 2022-03-21 14:34:22 -06:00
Andy John 4ee00f943f Use bit shifting instead of multiplying and dividing. 2022-03-21 14:34:22 -06:00
Behdad Esfahbod a28ea8d7f3 Simplify swap() 2021-11-01 22:50:54 -06:00
Behdad Esfahbod 38debbab7e [set] Add successful check in swap() 2021-11-01 22:17:35 -06:00
Behdad Esfahbod 1e3f57c079 [bit-set] Implement standard-5 methods plus swap 2021-11-01 21:14:12 -06:00
Behdad Esfahbod 41b9f2abcd [set] Add TODO item 2021-08-29 10:47:20 -06:00
Behdad Esfahbod 93ac700da6 [set] Add copy-constructor/assignment again 2021-08-29 10:47:20 -06:00
Behdad Esfahbod c90678cbc5 [set] One more try to fix things
That I don't let a "make check -j10" run finish before pushing things
out means either that we need to speed up our build / test process,
or I need a faster laptop...
2021-08-24 11:11:12 -06:00
Behdad Esfahbod 357976963e [set] One more try at fixing clear() on empty set 2021-08-24 10:59:31 -06:00
Behdad Esfahbod b5177d2147 [set] Fix seam exposed by previous commit 2021-08-24 10:43:37 -06:00
Behdad Esfahbod dc800ffd6c [bit-set] Remove TODO items we don't intend to finish 2021-08-19 15:41:27 -06:00
Behdad Esfahbod e8911d137c [bit-set-invertible] Implement a couple other missing corner cases
Also, in bit-set, don't compute population in is_equal/is_subset()
if we don't have it computed already.
2021-08-19 15:00:33 -06:00
Behdad Esfahbod ee4e331a6e [bit-set] Remove unused get_min(inverted) 2021-08-19 13:24:15 -06:00
Behdad Esfahbod b94f24ec79 [bit-set-invertible] Implement set algebra 2021-08-19 00:48:00 -06:00
Behdad Esfahbod 8aa92ff8f0 [bit-set-invertible] Implement get_min/max 2021-08-18 23:01:06 -06:00
Behdad Esfahbod 18f50275ed [bit-set] Restructure get_min/max() in prep for adding inverted 2021-08-18 22:08:06 -06:00
Behdad Esfahbod 0efa614c04 [bit-set] Add del_array/del_sorted_array() 2021-08-18 21:18:32 -06:00
Behdad Esfahbod 48ad9eef1e [bit-set] Merge page_for_insert() into page_for() 2021-08-18 21:05:21 -06:00