Forum Navigation
Issues with Stdout
Posted: 07/04/07 18:46:03Hello everyone.
I've coded a tiny raytracer today. It uses Phobos to output to stdout, and runs pretty fast for it's simplicity. Yesterday I did more or less the same raytracer, but it used Tango's Stdout object to print to console.
In both cases, stdout is redirected to file. But I get really poor performance on Tango (I'm using v0.98). Two raytracers are essentially the same, but one that uses std.stdio.writef() runs about a magnitude faster.
Also, do I have to flush Stdout manually? If I don't do it myself, I don't get any output at all. So I have to call the 'newline' method every time I choose to print anything. Is this right?
I'm not quite sure where the bottleneck is right now (I haven't profiled nor debugged my code), but I suspect it's on Tango's side. I'll do more checks when I have the time and post the results here.
I had similar issues with streaming buffers (Tango's iterators for files). It was reading file chunk by chunk in a streaming fashion -- and that was very, very slow. I replaced that with single file read into temporary buffer -- and it gave me 10-fold speed boost.