www.digitalmars.com         C & C++   DMDScript  

D - performance enhancements to std.stream

reply Ben Hinkle <bhinkle4 juno.com> writes:
I've put up a modified version of std.stream that buffers files
on Windows and has other tweaks that result in 10x performance
improvement on some large test files I threw at it.

http://home.comcast.net/~benhinkle/stream.d

I've banged on it a bit on Windows but I can't seem to get it
running on linux yet - when you try to use a stream it seg-v's.

Give it a shot - it should be backwards compatible except for
a few deprecated features that I think we should remove. There
are probably plenty of bugs in the buffering code when you mix
reads and write and seeks since the flushing logic is kinda 
messy (ps - why aren't there flush calls in windows.d and
linux.d?)

I also started in on an experimental stream.dprintf that 
prints D strings using %s and D Objects using %D. Objects
are stringified by calling toString.

-Ben
Mar 30 2004
parent reply Ben Hinkle <bhinkle4 juno.com> writes:
an update: linux works fine. I also took out the dprintf
stuff for now until I have more time - plus I'd like to
see how it compares to just using regular printf.
On linux though the buffering didn't give any speed
improvements so it must be that the OS already buffers.
I had actually though windows buffered, too, but I guess
not since it seems to make such a big difference.

On Tue, 30 Mar 2004 21:18:09 -0500, Ben Hinkle <bhinkle4 juno.com>
wrote:

I've put up a modified version of std.stream that buffers files
on Windows and has other tweaks that result in 10x performance
improvement on some large test files I threw at it.

http://home.comcast.net/~benhinkle/stream.d

I've banged on it a bit on Windows but I can't seem to get it
running on linux yet - when you try to use a stream it seg-v's.

Give it a shot - it should be backwards compatible except for
a few deprecated features that I think we should remove. There
are probably plenty of bugs in the buffering code when you mix
reads and write and seeks since the flushing logic is kinda 
messy (ps - why aren't there flush calls in windows.d and
linux.d?)

I also started in on an experimental stream.dprintf that 
prints D strings using %s and D Objects using %D. Objects
are stringified by calling toString.

-Ben

Mar 31 2004
parent "Kris" <someidiot earthlink.dot.dot.dot.net> writes:
10x performance? Nice job Ben!


"Ben Hinkle" <bhinkle4 juno.com> wrote in message
news:3r0n605cm7v0ncjnbv7oe0jdcku4b17ksa 4ax.com...
 an update: linux works fine. I also took out the dprintf
 stuff for now until I have more time - plus I'd like to
 see how it compares to just using regular printf.
 On linux though the buffering didn't give any speed
 improvements so it must be that the OS already buffers.
 I had actually though windows buffered, too, but I guess
 not since it seems to make such a big difference.

 On Tue, 30 Mar 2004 21:18:09 -0500, Ben Hinkle <bhinkle4 juno.com>
 wrote:

I've put up a modified version of std.stream that buffers files
on Windows and has other tweaks that result in 10x performance
improvement on some large test files I threw at it.

http://home.comcast.net/~benhinkle/stream.d

I've banged on it a bit on Windows but I can't seem to get it
running on linux yet - when you try to use a stream it seg-v's.

Give it a shot - it should be backwards compatible except for
a few deprecated features that I think we should remove. There
are probably plenty of bugs in the buffering code when you mix
reads and write and seeks since the flushing logic is kinda
messy (ps - why aren't there flush calls in windows.d and
linux.d?)

I also started in on an experimental stream.dprintf that
prints D strings using %s and D Objects using %D. Objects
are stringified by calling toString.

-Ben


Apr 01 2004