This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

startup speed (or lack thereof)


To figure out where all the startup time is going, I compiled with
profiling enabled (CFLAGS="-O2 -pg" ./configure --disable-shared) and
ran guile -c '(quit)'. Here are some of the results:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  us/call  us/call  name    
 20.00      0.08     0.08   116854     0.68     0.68  scm_getc
 17.50      0.15     0.07    10957     6.39     7.29  scm_strhash
 10.00      0.19     0.04    17703     2.26     2.26  scm_ungetc
  5.00      0.21     0.02    29730     0.67     0.67  scm_async_click
  5.00      0.23     0.02    26343     0.76     2.54  scm_flush_ws
  5.00      0.25     0.02    18586     1.08     1.08  scm_ilookup
  5.00      0.27     0.02     1616    12.38    43.93  scm_ceval
  5.00      0.29     0.02        2 10000.00 10000.00  scm_gc_sweep
  2.50      0.30     0.01    47900     0.21     0.21  scm_downcase
  2.50      0.31     0.01     8694     1.15     1.61  scm_acons
  2.50      0.32     0.01     6674     1.50     8.17  scm_read_token
  2.50      0.33     0.01     6665     1.50     8.79  scm_intern_obarray
  2.50      0.34     0.01     4096     2.44    18.83  scm_lreadparen
  2.50      0.35     0.01     2134     4.69    10.32  scm_sym2vcell
  2.50      0.36     0.01      540    18.52    18.52  scm_hashq_ref
  2.50      0.37     0.01      451    22.17    24.23  scm_m_define
  2.50      0.38     0.01      242    41.32    41.32  scm_gc_mark
  2.50      0.39     0.01        7  1428.57  1428.57  scm_string_append
  2.50      0.40     0.01        2  5000.00 20000.00  scm_igc
  0.00      0.40     0.00    26741     0.00     0.60  scm_cons
  0.00      0.40     0.00    17730     0.00     0.00  scm_fill_input
[rest deleted]

What this shows is that 30% of the startup time is taken by scm_getc() and
scm_ungetc(). The interesting thing is, if you do an strace of guile -c
'(quit)' and run grep open over it, you find that 4 scm files are loaded,
networking.scm, posix.scm, r4rs.scm, and boot-9.scm.

size of scm files			99139
scm_getc() calls - scm_ungetc() calls	99151

If you look at where the calls to scm_getc() are occuring, you see
68490 occur in scm_flush_ws() and 42992 occur in scm_read_token().
scm_flush_ws() should be easy to fix, scm_read_token() is a bit harder.

So, we're not calling read() on each character anymore, but we're still
calling scm_getc() on each character. Thought people might be interested
in this.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]