Hi,

Kevin Ryde <[EMAIL PROTECTED]> writes:

> Speaking of scm_getc ... I've wondered for a while if some of the low
> level reading funcs ought to be looking directly into the read buffer
> instead of making a call to scm_getc for every char.  My experience
> has usually been that a function call per character is very much to be
> avoided if performance on sizeable input matters.

You are right: `scm_getc ()' _is_ a performance bottleneck, one function
call for a single memory read (which is the common case when the port is
buffered) is way too much---`scm_getc ()' often shows up in the top 10
in Gprof's flat profile.

The whole point of having a buffer in a publicly-exposed struct is to
avoid function call overhead when accessing it.  Thus, `scm_getc ()'
should be inlined.

(You might have read that Guile-Reader is noticeably faster than
`scm_read ()'.  One of the reasons for this is that it inlines
`scm_getc ()' in the generated lightning code.)


Unfortunately, the machinery in `inline.h' makes it quite inconvenient
to add inline functions, and forces us to put all of them in a single
file.  GMP has a similar but slightly "cleaner" mechanism, which maybe
we could build upon to improve ours.

There are definitely a number of functions candidate for inlining in
Guile, typically functions that only execute a handful of instructions.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to