m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] m4: change command-line -H default


From: Eric Blake
Subject: [PATCH] m4: change command-line -H default
Date: Thu, 22 Apr 2021 15:41:57 -0500

* src/m4.h (HASHMAX): Bump to ~64k.
* doc/m4.texi (Limits control): Document it.
* NEWS: Likewise.
---

I'm debating whether to include this in the upcoming m4-1.4.19.  Thoughts?

 NEWS        | 3 +++
 doc/m4.texi | 6 +++---
 src/m4.h    | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 847a5f5c..a4bfbc7c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU M4 NEWS - User visible changes.

 * Noteworthy changes in release ?.? (????-??-??) [?]

+** The symbol hash table now defaults to 65537 buckets instead of 509, as
+   modern systems have enough memory to benefit from fewer hash collisions
+   by default.

 * Noteworthy changes in release 1.4.18 (2016-12-31) [stable]

diff --git a/doc/m4.texi b/doc/m4.texi
index ce9b5575..b7bad625 100644
--- a/doc/m4.texi
+++ b/doc/m4.texi
@@ -43,8 +43,8 @@
 @value{VERSION}), a package containing an implementation of the m4 macro
 language.

-Copyright @copyright{} 1989--1994, 2004--2014, 2016--2017, 2020 Free
-Software Foundation, Inc.
+Copyright @copyright{} 1989--1994, 2004--2014, 2016--2017, 2020--2021
+Free Software Foundation, Inc.

 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -791,7 +791,7 @@ Limits control
 @itemx --hashsize=@var{num}
 Make the internal hash table for symbol lookup be @var{num} entries big.
 For better performance, the number should be prime, but this is not
-checked.  The default is 509 entries.  It should not be necessary to
+checked.  The default is 65537 entries.  It should not be necessary to
 increase this value, unless you define an excessive number of macros.

 @item -L @var{num}
diff --git a/src/m4.h b/src/m4.h
index 89156acc..85a4e7ec 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -387,7 +387,7 @@ typedef enum symbol_lookup symbol_lookup;
 typedef struct symbol symbol;
 typedef void hack_symbol (symbol *, void *);

-#define HASHMAX 509             /* default, overridden by -Hsize */
+#define HASHMAX 65537             /* default, overridden by -Hsize */

 extern void free_symbol (symbol *sym);
 extern void symtab_init (void);
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]