serenity/AK
Andreas Kling 9d8da1697e AK: Automatically shrink HashTable when removing entries
If the utilization of a HashTable (size vs capacity) goes below 20%,
we'll now shrink the table down to capacity = (size * 2).

This fixes an issue where tables would grow infinitely when inserting
and removing keys repeatedly. Basically, we would accumulate deleted
buckets with nothing reclaiming them, and eventually deciding that we
needed to grow the table (because we grow if used+deleted > limit!)

I found this because HashTable iteration was taking a suspicious amount
of time in Core::EventLoop::get_next_timer_expiration(). Turns out the
timer table kept growing in capacity over time. That made iteration
slower and slower since HashTable iterators visit every bucket.
2022-03-07 00:08:22 +01:00
..
.clang-tidy Meta: Add basic clang-tidy configuration 2021-11-14 22:52:35 +01:00
AllOf.h AK: Reimplement all_of in terms of find_if 2021-07-24 13:11:13 +04:30
AnyOf.h AK: Implement any_of using common implementation 2021-08-06 23:57:48 +02:00
Array.h AK: Array can tell its inner type 2022-02-26 16:01:26 +01:00
Assertions.h AK: Suppress clang-tidy warning on TODO() 2022-02-21 19:01:16 +02:00
Atomic.h AK: Prevent Atomic with complex types 2022-02-23 00:42:49 +00:00
Badge.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Base64.cpp AK: Ignore whitespace while decoding base64 2022-02-25 19:54:13 +01:00
Base64.h AK+Userland: Make AK::decode_base64 return ErrorOr 2022-01-24 22:36:09 +01:00
BinaryBufferWriter.h AK: Add helper type for serializing structures into buffer 2021-07-18 19:58:17 +04:30
BinaryHeap.h AK: Add missing headers 2021-10-06 23:52:40 +01:00
BinarySearch.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
BitCast.h AK: Use __builtin_bit_cast if available 2021-08-21 13:48:59 +04:30
Bitmap.h AK: Make Bitmap construction OOM-fallible 2022-02-11 17:49:46 +02:00
BitmapView.h AK+Everywhere: Replace __builtin bit functions 2021-12-21 22:13:51 +01:00
BitStream.h LibCore: Introduce BigEndianInputBitStream 2022-01-22 01:13:42 +03:30
Buffered.h AK: Bypass Buffered's buffer for large reads 2021-12-17 13:13:00 -08:00
BuiltinWrappers.h AK+Everywhere: Replace __builtin bit functions 2021-12-21 22:13:51 +01:00
BumpAllocator.h AK: Make BumpAllocator work in multi-threaded environments 2021-10-31 18:43:03 +01:00
ByteBuffer.h AK: Don't call memcpy() in ByteBuffer::append(u8) 2022-02-13 14:44:36 +01:00
ByteReader.h AK: Generalize ByteReader 2021-07-14 11:26:34 +04:30
CharacterTypes.h AK: Change static base36 character map to function-local constexpr 2022-02-10 10:22:54 +00:00
Checked.h AK: Resolve clang-tidy warnings about unusual assignment operators 2021-11-14 22:52:35 +01:00
CheckedFormatString.h AK: Add missing Array.h include to CheckedFormatString.h 2021-12-24 14:35:33 -08:00
CircularDeque.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
CircularDuplexStream.h Everywhere: Fix many spelling errors 2022-01-07 10:56:59 +01:00
CircularQueue.h AK: Resolve clang-tidy readability-bool-conversion warnings 2021-11-14 22:52:35 +01:00
CMakeLists.txt Meta: Add support for declaring components 2021-06-17 11:03:51 +02:00
Complex.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
Concepts.h AK: Add the Fundamental concept 2022-02-23 00:42:49 +00:00
DateTimeLexer.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Debug.h.in LibWeb: Hide some debug logging behind CANVAS_RENDERING_CONTEXT_2D_DEBUG 2022-03-04 23:03:29 +01:00
Demangle.h AK: Remove kfree definition 2022-01-16 11:18:04 +01:00
DisjointChunks.h AK: Skip over initial empty chunks in DisjointChunks 2022-02-27 00:11:14 +03:30
DistinctNumeric.h Everywhere: Fix many spelling errors 2022-01-07 10:56:59 +01:00
DoublyLinkedList.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Endian.h AK: Add formatters for BigEndian and LittleEndian 2021-08-02 00:25:11 +02:00
EnumBits.h AK+Kernel: Implement and use EnumBits has_any_flag() 2021-07-16 11:49:50 +02:00
Error.h AK: VERIFY inside release_value_but_fixme_should_propagate_errors() 2022-02-16 19:49:41 -05:00
ExtraMathConstants.h Userland: Move non-standard math constants from math.h 2021-04-27 23:06:16 +02:00
FileStream.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Find.h AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith concept 2021-07-22 22:56:20 +02:00
FixedArray.h AK: Add at() indexing methods to FixedArray 2022-02-27 00:11:14 +03:30
FixedPoint.h AK: Add FixedPoint base 2 logarithm 2022-02-28 13:59:31 +01:00
FlyString.cpp AK: Implement FlyString's comparison operators in terms of StringView's 2022-01-29 23:08:27 +01:00
FlyString.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Format.cpp AK: Use string_view() instead of to_string() in Formatter<wchar_t> 2022-02-16 22:21:37 +01:00
Format.h AK: Support formatting Vectors with any inline_capacity 2022-02-03 23:33:20 +01:00
Forward.h AK: Add forward declaration for Utf8CodePointIterator 2022-02-23 21:53:30 +00:00
Function.h AK: Suppress false positive readability-non-const-parameter in Function 2021-11-14 22:52:35 +01:00
GenericLexer.cpp AK: Exclude GenericLexer String APIs from the Kernel 2022-02-16 22:21:37 +01:00
GenericLexer.h AK: Exclude GenericLexer String APIs from the Kernel 2022-02-16 22:21:37 +01:00
HashFunctions.h AK: Use a full-period xorshift PRNG for double_hash 2022-01-07 12:34:44 +01:00
HashMap.h AK: Remove return value from HashTable::remove() and HashMap::remove() 2022-03-07 00:08:22 +01:00
HashTable.h AK: Automatically shrink HashTable when removing entries 2022-03-07 00:08:22 +01:00
Hex.cpp AK: Return KString instead of String from encode_hex in the Kernel 2022-02-16 22:21:37 +01:00
Hex.h AK: Return KString instead of String from encode_hex in the Kernel 2022-02-16 22:21:37 +01:00
IDAllocator.h AK: Use get_random() in IDAllocator 2021-08-30 18:35:36 +02:00
IntegralMath.h AK: Move integral log2 and exp to IntegerMath.h 2022-02-06 17:52:33 +00:00
IntrusiveDetails.h AK: Add missing headers 2021-10-06 23:52:40 +01:00
IntrusiveList.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
IntrusiveListRelaxedConst.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
IntrusiveRedBlackTree.h AK+Kernel: Reduce the number of template parameters of IntrusiveRBTree 2021-09-10 18:05:46 +03:00
IPv4Address.h AK+Kernel: Return KString from IPv4Address::to_string() in the Kernel 2022-02-16 22:21:37 +01:00
IterationDecision.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Iterator.h AK: Explicitly name types in Iterator.h 2022-01-16 00:38:21 +03:30
JsonArray.h Everywhere: Make JSON serialization fallible 2022-02-27 20:37:57 +01:00
JsonArraySerializer.h Everywhere: Make JSON serialization fallible 2022-02-27 20:37:57 +01:00
JsonObject.h Everywhere: Make JSON serialization fallible 2022-02-27 20:37:57 +01:00
JsonObjectSerializer.h Everywhere: Make JSON serialization fallible 2022-02-27 20:37:57 +01:00
JsonParser.cpp AK: Fix userland parsing of rounded floating point numbers 2022-02-16 07:22:51 -05:00
JsonParser.h AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional) 2021-11-17 00:21:10 +01:00
JsonPath.cpp AK: Add implied const qualifiers to the Json interface 2021-12-15 23:35:14 -08:00
JsonPath.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
JsonValue.cpp AK: Allow constructing a JsonValue from a StringView explicitly 2022-01-28 23:40:25 +01:00
JsonValue.h AK: Exclude JsonValue String APIs from the Kernel 2022-02-16 22:21:37 +01:00
kmalloc.cpp AK: Declare operators new and delete as global functions 2021-07-05 20:23:42 +02:00
kmalloc.h AK: Remove kfree definition 2022-01-16 11:18:04 +01:00
kstdio.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
LEB128.h AK: Don't perform the shift when it's too large when decoding LEB128 2021-08-31 16:37:49 +02:00
LexicalPath.cpp AK: Add LexicalPath::prepend() 2021-11-22 09:03:47 +01:00
LexicalPath.h AK: Add LexicalPath::prepend() 2021-11-22 09:03:47 +01:00
MACAddress.h AK+Kernel: Return KString from MACAddress::to_string() in the Kernel 2022-02-16 22:21:37 +01:00
Math.h AK: Don't use x86 assembly when building for non-x86 targets 2022-02-19 13:13:22 +02:00
MemMem.h Everywhere: Remove redundant inline keyword 2022-01-29 21:45:17 +02:00
Memory.h AK: Use x86 specific fast path in fast_u32{fill, copy} on x86_64 2022-01-26 01:16:43 +02:00
MemoryStream.h Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr 2022-01-24 22:36:09 +01:00
NeverDestroyed.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NoAllocationGuard.h Everywhere: Use my new serenityos.org e-mail :^) 2022-01-14 11:54:09 +01:00
Noncopyable.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NonnullOwnPtr.h AK: Hide the infallible make<T> factory function from the Kernel 2022-02-03 23:33:20 +01:00
NonnullOwnPtrVector.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NonnullPtrVector.h AK: Use default constructor/destructor instead of declaring an empty one 2021-09-16 17:17:13 +02:00
NonnullRefPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
NonnullRefPtrVector.h AK: Make NonnullRefPtrVector constructible from Vector<NonnullRefPtr> 2021-06-11 00:30:09 +02:00
NumberFormat.h AK: Added human_readable_time() method for "unsaved changes" dialogs 2022-01-09 20:25:48 -08:00
NumericLimits.h AK: Use proper type for bool NumericLimits::min and max specialization 2021-11-14 22:52:35 +01:00
Optional.h AK: Make Optional<T> explicitly constructible from Optional<U> 2022-01-23 18:53:42 +02:00
OwnPtr.h AK: Convert the try_make<T> factory function to use ErrorOr 2022-02-03 23:33:20 +01:00
Platform.h AK+Everywhere: Replace __builtin bit functions 2021-12-21 22:13:51 +01:00
PrintfImplementation.h AK: Print NaN and infinite numbers in PrintfImplementation 2022-03-02 11:40:37 +01:00
Ptr32.h AK: Fix building Ptr32 on x86_64 2021-06-24 09:27:13 +02:00
Queue.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
QuickSort.h AK: Guarantee a maximum stack depth for dual_pivot_quick_sort 2021-04-28 21:38:48 +02:00
Random.cpp AK: Introduce get_random_uniform() 2021-05-14 22:24:02 +02:00
Random.h AK+LibCore: Standardize on AK_OS_MACOS instead of __APPLE__ 2021-09-12 18:31:10 +02:00
RecursionDecision.h AK: Add RecursionDecision 2021-08-07 15:21:58 +02:00
RedBlackTree.h AK: Clear minimum when removing last node of RedBlackTree 2022-02-10 14:09:39 +00:00
RefCounted.h AK+Kernel: Remove one_ref_left() footgun 2022-01-11 01:12:16 +01:00
RefCountForwarder.h AK: Add RefCountForwarder<T> 2021-12-09 21:28:52 +01:00
RefPtr.h Kernel: Convert try_make_ref_counted to use ErrorOr 2022-02-03 23:33:20 +01:00
Result.h AK: Allow to "get a result" from Result<void> 2021-11-28 13:33:51 -08:00
ScopedValueRollback.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ScopeGuard.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ScopeLogger.h AK: Store the 'extra' field of ScopeLogger as String 2021-06-29 00:07:19 +04:30
SIMD.h AK: Add char SIMD types 2021-07-22 23:33:21 +02:00
SIMDExtras.h LibGL+LibSoftGPU: Implement the stencil buffer 2022-01-17 12:49:00 +01:00
SIMDMath.h AK/SIMD: Suppress psabi warnings and add explanatory comment 2022-01-09 21:03:08 +01:00
Singleton.h AK: Yield while waiting for another thread to initialize a Singleton 2022-01-19 01:28:13 +01:00
SinglyLinkedList.h AK: Fix erroneous move operators for SinglyLinkedList 2022-01-19 00:13:56 +01:00
SinglyLinkedListWithCount.h Everywhere: Use bgianf@serenityos.org for my copyright attribution 2021-04-22 21:15:54 +02:00
SourceGenerator.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SourceLocation.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
Span.h AK: Add constructor to create Span from Array 2022-02-26 16:01:26 +01:00
Stack.h AK: Use unchecked_append in AK::Stack, as we always validate the size 2022-01-05 14:04:18 +01:00
StackInfo.cpp AK: Fix preprocessor OS check 2021-12-12 11:10:34 -08:00
StackInfo.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Statistics.h AK: Add min and max functions to Statistics 2021-11-06 22:09:25 -07:00
StdLibExtraDetails.h AK: Add the concept of hash-compatible types 2021-12-15 13:09:49 +03:30
StdLibExtras.h AK: Add is_power_of_2 helper 2022-01-29 17:41:06 +02:00
Stream.h LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void> 2021-11-28 23:14:19 +01:00
String.cpp AK: Add String::split_view(Function<bool(char)>) 2022-02-25 19:38:31 +01:00
String.h AK: Add String::split_view(Function<bool(char)>) 2022-02-25 19:38:31 +01:00
StringBuilder.cpp AK: Add a try variant of StringBuilder::append_escaped_for_json 2022-02-27 20:37:57 +01:00
StringBuilder.h AK: Add a try variant of StringBuilder::append_escaped_for_json 2022-02-27 20:37:57 +01:00
StringHash.h AK: Define a traits helper for case-insensitive StringView hashing 2022-01-11 00:36:45 +01:00
StringImpl.cpp AK: Make CaseInsensitiveStringTraits allocation-free 2022-02-19 14:45:59 +01:00
StringImpl.h AK: Make CaseInsensitiveStringTraits allocation-free 2022-02-19 14:45:59 +01:00
StringUtils.cpp AK: Exclude StringUtils String APIs from the Kernel 2022-02-16 22:21:37 +01:00
StringUtils.h AK: Add convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
StringView.cpp AK: Exclude StringView String APIs from the Kernel 2022-02-16 22:21:37 +01:00
StringView.h AK: Exclude StringView String APIs from the Kernel 2022-02-16 22:21:37 +01:00
TemporaryChange.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Time.cpp AK: Add Time::from_ticks() 2022-02-28 20:09:37 +01:00
Time.h AK: Add Time::from_ticks() 2022-02-28 20:09:37 +01:00
Traits.h AK: Support using custom comparison operations for hash compatible keys 2022-01-29 23:01:23 +02:00
Trie.h AK+Kernel: Specialize Trie for NNOP<KString> and use it in UnveilNode 2022-02-16 22:21:37 +01:00
Try.h AK: Mark the error branch of the TRY() macro as unlikely 2022-01-16 02:01:23 +02:00
Tuple.h AK: Correct Tuple's constructor signatures 2021-08-02 17:22:50 +04:30
TypeCasts.h AK: Rename downcast<T> => verify_cast<T> 2021-06-24 19:57:01 +02:00
TypedTransfer.h AK: Fast path for single-element TypedTransfer::copy 2021-12-17 13:13:00 -08:00
TypeList.h Everywhere: "indexes" => "indices" 2021-04-29 22:23:52 +02:00
Types.h AK+Kernel: Suppress clang-tidy warnings from the cert-* category 2021-11-14 22:52:35 +01:00
UBSanitizer.h AK+Kernel+LibSanitizer: Store "ubsan-is-deadly" flag as Atomic<bool> 2022-02-03 16:11:26 +01:00
UFixedBigInt.h AK: Fix UFixedBigInt comparison operators 2022-01-04 06:01:22 +00:00
UnicodeUtils.h AK: Remove now-unused AK::UnicodeUtils methods 2022-01-18 15:13:25 +00:00
URL.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
URL.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
URLParser.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
URLParser.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Userspace.h AK+Kernel: Remove implicit conversion from Userspace<T*> to FlatPtr 2021-11-16 00:13:22 +01:00
Utf8View.cpp AK: Inline all the trivial Utf8View functions 2021-09-18 19:54:24 +02:00
Utf8View.h AK: Make Utf8View constexpr-constructible 2022-01-17 14:46:07 +00:00
Utf16View.cpp AK: Add a Utf16View::code_unit_offset_of(Utf16CodePointIterator) helper 2022-01-31 21:05:04 +02:00
Utf16View.h AK: Add a Utf16View::code_unit_offset_of(Utf16CodePointIterator) helper 2022-01-31 21:05:04 +02:00
Utf32View.h AK: Add the at()/operator[]() getter to Utf32View 2021-07-18 21:10:55 +04:30
UUID.cpp AK: Return KString instead of String from encode_hex in the Kernel 2022-02-16 22:21:37 +01:00
UUID.h AK+Kernel: Return KString from UUID::to_string() in the Kernel 2022-02-16 22:21:37 +01:00
Variant.h AK: Conditionally disable a few variant ctors/assignments 2022-02-15 18:03:02 +02:00
Vector.h AK: Make Vector::data() ALWAYS_INLINE 2022-02-05 16:48:14 +01:00
Weakable.h Kernel: Remove make_weak_ptr() 2022-02-13 23:02:57 +01:00
WeakPtr.h AK+Kernel: Add an OOM-fallible try variant make_weak_ptr() 2022-02-13 23:02:57 +01:00