From: jcb@... (MetalOne) Date: 2002-11-18T14:08:18+09:00 Subject: Re: Not really a ruby question, but this is a smart group. Win32 file.write timing. Arg!! I feel like such an idiot. Sometimes you just have to tell somebody your problems, before you see the big picture. I was so concerned with individual frame times, that I wasn't looking very hard at total time. I switch from fwrite() to WriteFile() because it seemed to improve frame times. However, WriteFile() doesn't do buffered I/O. Comparing fwrite() to WriteFile() revealed a significant difference in total time. Using setvbuf(100*frameSize) improved times even further. More signficantly all frames were now written in less than 1.5ms, except for every 100th frame, which was upwards of 250ms. The ruby script actually outperforms the C++ code. 22 secs vs. 27 secs. The C++ code seemed to do some sort of flushing every 100th frame, whereas the Ruby code had a very different pattern. So, the erratic timing is based upon how the buffer is flushed.