[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add `scm_std_read ()'
From: |
Neil Jerram |
Subject: |
Re: Add `scm_std_read ()' |
Date: |
Tue, 15 Apr 2008 23:40:09 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
address@hidden (Ludovic Courtès) writes:
> Hi,
>
> This is roughly a followup to:
>
> http://thread.gmane.org/gmane.lisp.guile.devel/6549/focus=6613
>
> The attached patch adds an `scm_std_read ()' call, which is to read(2)
> what `scm_std_select ()' is to select(2). It changes `fport_fill_input'
> to use it, which removes the call to select(2) that precedes each
> read(2) call (!).
>
> Using the same "I/O benchmark" as in my previous message, and compared
> to Guile with the inlined `scm_getc' patch, it yields an additional 5%
> speedup when reading by 4096-octet blocks, and a negligible improvement
> when using smaller buffer sizes.
>
> OK to apply?
I'm not sure. There are two cases which previously didn't leave and
re-enter guile mode, and now do: (i) where there is already input
available (fport_input_waiting), (ii) where the fd is non-blocking.
Leaving and re-entering guile mode feels quite expensive to me; it's
at least locking and unlocking a mutex. I'm surprised that doesn't
outweigh the gain of not calling select() a couple of times. Are you
sure that it does?
Regards,
Neil