1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00
Commit Graph

50 Commits

Author SHA1 Message Date
Bruno Haible
772a63e46d Optimize: Use a hash table in compute_partition.
This reduces the execution time of gperf on large inputs by ca. 30%.

* autogen.sh (GNULIB_MODULES): Add map-c++, hash-map.
* src/keyword.h: Include <stddef.h>.
(struct KeywordExt): Add fields _undetermined_chars,
_undetermined_chars_length, _undetermined_chars_hashcode.
* src/search.cc: Include gl_map.hh, gl_hash_map.h.
(Search::prepare_asso_values): Initialize the _undetermined_chars field.
(struct EquivalenceClass): Remove the fields _undetermined_chars,
_undetermined_chars_length.
(undetermined_equals, undetermined_hashcode): New functions.
(Search::compute_partition): Initialize the _undetermined_chars* fields
of all keywords. Use a hash map instead of a loop over the equivalence
classes.
(Search::find_good_asso_values): Deallocate the _undetermined_chars field.
2025-04-19 15:03:10 +02:00
Bruno Haible
8872451544 Improve comments.
* src/search.cc: Fix comments.
2025-04-17 17:30:21 +02:00
Bruno Haible
6ca5ea1384 build: Use more gnulib modules.
* autogen.sh (GNULIB_MODULES): Add read-file.
Copy also config.guess and config.sub.
* lib/Makefile.am (BUILT_SOURCES, MOSTLYCLEANDIRS): New variables.
(libgp_a_SOURCES): Remove getline.h, getline.cc.
* lib/getline.h: Remove file.
* lib/getline.cc: Remove file.
* src/configure.ac: Change config.h to also include ../lib/config.h.
* src/output.cc: Include <config.h> first.
* src/search.cc: Likewise.
* src/bool-array.cc: Include <config.h>.
* src/keyword.cc: Likewise.
* src/keyword-list.cc: Likewise.
* src/hash-table.cc: Likewise.
* src/main.cc: Likewise.
* src/options.cc: Likewise.
* src/positions.cc: Likewise.
* src/version.cc: Likewise.
* src/input.cc: Likewise. Include read-file.h instead of getline.h.
(Input<KT>::read_input): Use fread_file instead of get_delim.
2025-04-16 22:28:11 +02:00
Bruno Haible
b3c3566855 Prefer https URLs where possible. 2018-09-17 16:53:00 +02:00
Bruno Haible
24f492fd8d Improve the speed of the positions search. 2018-09-08 16:08:09 +02:00
Bruno Haible
947854520b Really prefer more efficient hash functions over less efficient ones. 2018-09-08 15:56:21 +02:00
Bruno Haible
825b077bf4 Fix copyright years. 2017-02-22 15:32:38 +01:00
Bruno Haible
efd1fd8439 Fix g++ -Wall warnings. 2016-11-25 20:03:51 +01:00
Bruno Haible
57745086ac Don't include the length in the hash function if all keywords have the same
length.
2009-01-19 09:50:07 +00:00
Bruno Haible
f6c3e9a753 Change source code license to GPLv3+. 2008-08-23 18:52:48 +00:00
Bruno Haible
61ba5cd46a Update FSF postal address. 2005-05-14 14:22:35 +00:00
Bruno Haible
ab6f0966b7 Cleanup the alpha_unify handling code. 2003-04-11 09:10:58 +00:00
Bruno Haible
f619dea2f5 Portability: Use stack-allocated arrays only if the compiler supports them. 2003-04-10 10:26:05 +00:00
Bruno Haible
bfefa088aa Renamings and small reorganizations. 2003-04-09 10:24:59 +00:00
Bruno Haible
2535f34494 Move the handling of ALLCHARS (-k'*') into the Positions class. 2003-04-07 09:50:11 +00:00
Bruno Haible
ec3d1127fa Change the positions to be 0-based, instead of 1-based. 2003-04-04 10:04:24 +00:00
Bruno Haible
7dfd32b736 New option --ignore-case. 2003-04-02 09:26:05 +00:00
Bruno Haible
0093e33163 Fill unused asso_values[] entries in search.cc, not in output.cc. 2003-04-01 08:13:30 +00:00
Bruno Haible
8193024d96 Additional check for the keywords. 2003-03-31 10:09:58 +00:00
Bruno Haible
d51ed07a80 Portability to old compilers (such as MSVC). 2003-03-30 14:32:27 +00:00
Bruno Haible
6d268d095b Completely new asso_values search algorithm. 2003-03-18 10:22:37 +00:00
Bruno Haible
40f37680ac Use 'unsigned int' instead of 'int' where it makes sense. 2003-03-17 09:06:26 +00:00
Bruno Haible
7a8b43182a Optimized choice during collision resolution. 2003-03-14 11:01:01 +00:00
Bruno Haible
19c69d8e5a Better debugging output. 2003-03-13 10:31:35 +00:00
Bruno Haible
6ba5486229 Make the option -s easier to use. 2003-03-10 15:01:00 +00:00
Bruno Haible
9492f0dad7 Improve debugging output. 2003-03-04 06:05:14 +00:00
Bruno Haible
9fa3ac42b3 Portability fixes. 2003-03-03 14:28:09 +00:00
Bruno Haible
ea37cea17b Make the backtracking look like a standard Prolog box. 2003-02-25 12:01:50 +00:00
Bruno Haible
ee424350d0 Avoid gcc warnings about uninitialized variables. 2003-02-24 10:30:04 +00:00
Bruno Haible
76575063ea Implement backtracking. 2003-02-22 00:19:28 +00:00
Bruno Haible
f1da37e04b Prepare for backtracking. 2003-02-20 12:21:17 +00:00
Bruno Haible
1d73fbe019 Comments and code restructuring. 2003-02-19 12:32:06 +00:00
Bruno Haible
ec800f65ec Introduce new alpha_inc pass, to avoid artificial duplicates. 2003-02-17 10:36:47 +00:00
Bruno Haible
799d1c7534 Change element type of _selchars from 'unsigned char' to 'unsigned int'. 2003-02-14 12:52:29 +00:00
Bruno Haible
810fef43ae When the option -k is not given, the default key positions are now computed
depending on the set of keywords.
2003-02-11 11:09:27 +00:00
Bruno Haible
a9916548fa Fix memory leaks. 2003-01-23 12:03:33 +00:00
Bruno Haible
10a159ea9b Free allocated arrays. 2003-01-17 12:57:10 +00:00
Bruno Haible
826e4c8ba1 An abstract mergesort function. 2003-01-16 12:41:41 +00:00
Bruno Haible
c3467c5302 New option --multiple-iterations. 2003-01-15 13:01:25 +00:00
Bruno Haible
c67f999b54 Bug fix: make -j 0 work. 2003-01-14 12:45:46 +00:00
Bruno Haible
741d34fb07 Use const where possible. 2003-01-13 19:57:56 +00:00
Bruno Haible
cd08b4d519 Restructure the asso_values[] searching code. 2003-01-07 12:40:05 +00:00
Bruno Haible
b91e4511c0 Continuing rework. 2003-01-06 11:43:41 +00:00
Bruno Haible
72a3884ff9 Fix the reorder logic. 2002-12-31 12:53:17 +00:00
Bruno Haible
1f70ea5dfd Compute the occurrences after removal of duplicates, not before. 2002-12-20 12:22:27 +00:00
Bruno Haible
1186e616cb Rework the hash table code. 2002-12-19 12:35:17 +00:00
Bruno Haible
21cd7bfd24 Use 'unsigned char' instead of 'char' in many places, to reduce casts. 2002-12-16 14:40:19 +00:00
Bruno Haible
bd03d0bce8 First include is the specification's .h file. 2002-11-29 12:52:54 +00:00
Bruno Haible
c73312f0fd Remove the global vectors. Move them to the class Search. 2002-11-28 12:56:08 +00:00
Bruno Haible
aca3f4abae Move the search algorithm to search.h, search.cc. 2002-11-26 12:48:39 +00:00