1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

tune default hash table sizes

* libguile/modules.c: In my current image, there are 1790 bindings in
  the root module, which tips over to the next hash vector size, so
  declare that to prevent rehashing.
* libguile/srcprop.c (scm_init_srcprop): Don't preallocate a big
  source_whash table, as we might not need it (if everything is
  compiled, for example).
* module/ice-9/boot-9.scm (make-module): Don't preall-cate big hash
  tables for imported bindings.  Instead trust that resizing works
  correctly.
This commit is contained in:
Andy Wingo 2012-02-19 15:19:14 +01:00
parent 3753e22736
commit 917b0e72f7
3 changed files with 4 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008,2009,2010,2011,2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -1000,7 +1000,7 @@ SCM_SYMBOL (scm_sym_system_module, "system-module");
void
scm_modules_prehistory ()
{
scm_pre_modules_obarray = scm_c_make_hash_table (1533);
scm_pre_modules_obarray = scm_c_make_hash_table (1790);
}
void

View file

@ -347,7 +347,7 @@ scm_init_srcprop ()
scm_tc16_srcprops = scm_make_smob_type ("srcprops", 0);
scm_set_smob_print (scm_tc16_srcprops, srcprops_print);
scm_source_whash = scm_c_make_weak_table (2047, SCM_WEAK_TABLE_KIND_KEY);
scm_source_whash = scm_c_make_weak_table (0, SCM_WEAK_TABLE_KIND_KEY);
scm_c_define ("source-whash", scm_source_whash);
scm_last_alist_filename = scm_cons (SCM_EOL,

View file

@ -1803,10 +1803,6 @@ VALUE."
;; initial uses list, or binding procedure.
;;
(define* (make-module #:optional (size 31) (uses '()) (binder #f))
(define %default-import-size
;; Typical number of imported bindings actually used by a module.
600)
(if (not (integer? size))
(error "Illegal size to make-module." size))
(if (not (and (list? uses)
@ -1819,7 +1815,7 @@ VALUE."
(let ((module (module-constructor (make-hash-table size)
uses binder #f macroexpand
#f #f #f
(make-hash-table %default-import-size)
(make-hash-table)
'()
(make-weak-key-hash-table 31) #f
(make-hash-table 7) #f #f #f)))