Hi (back on the list),
I have a program that needs IO#read to be fast. I found out that IO#read
uses C’s getc() instead of fread(). This is several times slower than
fread(), as I tried it. However, I think my solution would not work with
Ruby threads. Is there a way to use fread() to get sensible amounts of
data without fear of blocking?
If there is a problem with READ_DATA_PENDING, then another way Ruby IO
could work is by permanently setting the non-blocking flag on all open
filehandles, and then fake the rest to Ruby programs.
What do you think?
···
Mathieu Bouchard http://artengine.ca/matju
Hi,
I have a program that needs IO#read to be fast. I found out that IO#read
uses C’s getc() instead of fread(). This is several times slower than
fread(), as I tried it. However, I think my solution would not work with
Ruby threads. Is there a way to use fread() to get sensible amounts of
data without fear of blocking?
I know, see 1.7.
If there is a problem with READ_DATA_PENDING, then another way Ruby IO
could work is by permanently setting the non-blocking flag on all open
filehandles, and then fake the rest to Ruby programs.
We just had discussion about non-blocking IO in ruby-dev last
week. I thought about it too, but there is an issue. The flag
is shared by parent and child processes. At least, bash resets
the flag always after chilren exited, but other programs almost
don’t work with it.
LWP library of old SunOS also could be used together with
libnbio, and had same issue.
···
At Sun, 4 Aug 2002 09:55:35 +0900, Mathieu Bouchard wrote:
–
Nobu Nakada
Never mind, it’s using fread() in 1.7.
Speaking of which, when did Process::Status appear ? it broke one of my
programs.
···
On Sun, 4 Aug 2002, Mathieu Bouchard wrote:
I have a program that needs IO#read to be fast. I found out that IO#read
uses C’s getc() instead of fread(). This is several times slower than
fread(), as I tried it. However, I think my solution would not work with
Ruby threads. Is there a way to use fread() to get sensible amounts of
data without fear of blocking?
Mathieu Bouchard http://artengine.ca/matju
Nothing. I had written all of my code for 1.6, really, and that’s all. I
want to keep compatibility with both 1.6 and 1.7, but often I forget to
test with both. I realize that not only are they slowly diverging, but
things that were changed a long time ago can take a lot of time to me to
notice (back then, 1.6 and the Pickaxe were still rather new). That’s my
own fault for not reading the ChangeLog attentively, I guess.
···
On Sun, 4 Aug 2002 nobu.nokada@softhome.net wrote:
At Sun, 4 Aug 2002 12:16:42 +0900, > Mathieu Bouchard wrote:
Speaking of which, when did Process::Status appear ? it broke one of my
programs.
1.7.0 20010215. What’s problem?
Mathieu Bouchard http://artengine.ca/matju