recommend use of gperf version 3

Bruno Haible bruno@clisp.org
Mon Jun 6 10:27:00 GMT 2005


Hi,

The files cp/cfns.gperf and java/keyword.gperf are - as distributed -
processed by gperf-2.7.2 or with particular options. The use of gperf-3.0.1
(released in 2003) can create smaller and faster hash tables, with less
command line options:

* cp/cfns.gperf: If you drop the options "-k '1-6,$' -j1 -D" and add
  instead "-m 10",
  - the hash function accesses 4 bytes of the input string (instead of 7),
  - the hash table size drops to 317 (instead of 391).

* java/keyword.gperf: If you drop the options "-j1 -i 1 -g -o -k'1,4,$'" and
  add instead "-m 10",
  - the hash function accesses 2 bytes of the input string (instead of 3),
  - the hash table size drops to 53 (instead of 79).

Find attached a patch that does this.

cp/ChangeLog:
2005-06-05  Bruno Haible  <bruno@clisp.org>

	* Make-lang.in ($(srcdir)/cp/cfns.h): Use gperf option -m 10.
	Bail out if gperf is too old.

java/ChangeLog:
2005-06-05  Bruno Haible  <bruno@clisp.org>

	* Make-lang.in ($(srcdir)/java/keyword.h): Use gperf option -m 10.

*** gcc-4.0.0/gcc/cp/Make-lang.in.bak	Tue Jan 18 12:45:31 2005
--- gcc-4.0.0/gcc/cp/Make-lang.in	Sun Jun  5 17:26:28 2005
***************
*** 97,104 ****
  
  # Special build rules.
  $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
! 	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
! 		$(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
  
  gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
  gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h : s-gtype; @true
--- 97,108 ----
  
  # Special build rules.
  $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
! 	gperf -o -C -E -N 'libc_name_p' -L ANSI-C -m 10 \
! 		$(srcdir)/cp/cfns.gperf > c$$$$.h || { \
! 	echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
! 	rm -f c$$$$.h; \
! 	exit 1; } ; \
! 	mv -f c$$$$.h $(srcdir)/cp/cfns.h
  
  gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
  gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h : s-gtype; @true
*** gcc-4.0.0/gcc/java/Make-lang.in.bak	Sat Mar 12 03:16:28 2005
--- gcc-4.0.0/gcc/java/Make-lang.in	Sun Jun  5 17:24:01 2005
***************
*** 87,93 ****
  
  $(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
  	(cd $(srcdir)/java || exit 1; \
! 	gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
  		keyword.gperf > k$$$$.h || { \
  	echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
  	rm -f k$$$$.h; \
--- 87,93 ----
  
  $(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
  	(cd $(srcdir)/java || exit 1; \
! 	gperf -L ANSI-C -C -F ', 0' -p -t -N java_keyword -m 10 \
  		keyword.gperf > k$$$$.h || { \
  	echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
  	rm -f k$$$$.h; \



More information about the Gcc-patches mailing list