Commit Graph

36 Commits

Author SHA1 Message Date
d084a80023 Hashtable: skip rehashing if the size is the same
Hashtable_setSize should not rehash if the actual size stays the same as
the number of buckets and natural positions stay the same too.
2021-12-13 21:05:22 +01:00
94ad111391 Update license headers to explicitly say GPLv2+ 2021-09-22 14:28:19 +02:00
2bf626c4e4 IWYU update 2021-08-25 09:54:30 +02:00
1b74dfe187 cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
66dd77aa6b Hashtable: use appropriate return type for nextPrime
The return value is guaranteed to be smaller than SIZE_MAX, so return
size_t (matters on 32 bit architectures).
2021-01-12 16:37:43 +01:00
8e10cde800 Hashtable: fail hard on too big size request 2021-01-06 16:59:28 +01:00
ca2c01bd16 Hashtable: widen size from int to size_t 2021-01-06 16:59:28 +01:00
7043a93eba Hashtable: hide implementation of Hashtable and HashtableItem 2021-01-06 16:59:28 +01:00
8fe04b7494 Hashtable: use more distinct typename for key type 2021-01-06 16:59:28 +01:00
7ba25aa3c4 IWYU update 2020-12-06 15:32:16 +01:00
c1563337ae Implement Hashtable_clear to empty an existing Hashtable 2020-11-29 14:54:10 +01:00
7cf5277594 IWYU update (Linux) 2020-11-19 23:51:50 +01:00
307c34b028 Hashtable: use dynamic growth and use primes as size
Dynamically increase the hashmap size to not exceed the load factor and
avoid too long chains.

Switch from Separate Chaining to Robin Hood linear probing to improve
cache locality.

Use primes as size to further avoid collisions.

E.g. on a standard kde system the number of entries in the ProcessTable
might be around 650.
2020-11-17 02:01:02 +01:00
7914ec201e Hashtable update
- use consistent type for key by introducing a new typedef
- use unsigned types for sizes
- name parameters in foreach function typedef
2020-11-17 02:01:02 +01:00
45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
5e4b182616 Combine XAlloc.[ch] into XUtils.[ch] 2020-10-17 20:54:14 +02:00
e5fdb80c7d Fix Hashtable_put to allow storing the same pointer 2020-10-09 12:23:16 +02:00
079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
d69585b82a Resolve DEBUG compilation issues
Use NDEBUG conditional instead of DEBUG.

Do not call static functions in extern inline ones.
    Vector.c:67:11: error: static function 'Vector_isConsistent' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
2020-10-03 19:04:27 +02:00
a1a027b9bd Axe automated header generation.
Reasoning:
 - implementation was unsound -- broke down when I added a fairly
   basic macro definition expanding to a struct initializer in a *.c
   file.

 - made it way too easy (e.g. via otherwise totally innocuous git
   commands) to end up with timestamps such that it always ran
   MakeHeader.py but never used its output, leading to overbuild noise
   when running what should be a null 'make'.

 - but mostly: it's just an awkward way of dealing with C code.
2020-09-03 11:58:58 -05:00
dd33444f7e Clean up existing whitespace 2019-10-31 11:39:12 -05:00
b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
445222e48c Clean up some needless malloc casts, convert some mallocs to callocs, and fix some style 2015-09-16 23:42:36 -04:00
76a715ee8c Fix order of calloc arguments.
(Patch by Dawid Gajownik)
2014-01-16 18:51:16 -02:00
45f7a4fc8d Remove old memory debugging routines. We have Valgrind nowadays. 2011-12-26 22:04:29 +00:00
84281bdc44 major header cleanup 2011-12-26 21:35:57 +00:00
300caa076e Tempus fugit. 2011-05-26 16:35:07 +00:00
a600d5a6e9 Tempus fugit. 2010-02-25 02:08:18 +00:00
da23c8c5a1 Clean up headers by using 'static' whenever possible.
Reduces resulting code size.
2008-03-09 08:58:38 +00:00
a227b20fef Switch to unsigned keys in hash, according to issue #1688290
in the sf tracker
2007-04-05 19:53:23 +00:00
36848494f5 Add debugging sanity checks. 2006-11-12 21:52:14 +00:00
2713119249 Add missing header. 2006-11-08 21:49:07 +00:00
110ce71b9b Add consistency checks. 2006-11-08 20:09:48 +00:00
dbe2670b69 Perform RichString operations by hand.
Avoid unnecessary operations when processing entries on ProcessList.
2006-07-12 01:16:03 +00:00
5d48ab8c28 Performance improvement hackathon: improve process comparison routines,
disable useless code in release builds such as runtime type-checking on
dynamic data structures and process fields that are not being computed,
faster(?) method for verifying the process owner (still need to ensure
correctness), don't destroy and create process objects for hidden kernel
threads over and over. Phew. I shouldn't be doing all this today, but I
could not resist.
2006-07-11 06:13:32 +00:00
d6231bab89 Initial import. 2006-03-04 18:16:49 +00:00