If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Slow performance with new 3GHz Machine using FlushFileBuffers
Hi,
I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. Same system (Windows 2000), same installed software, same hard disk (IDE), same configuration. I have tried with other hard disks, same result. Note: if I withdraw the FlushFileBuffers function call, I have a little better result in my new machine. I need to use this call or something similar to asure data saving. (at least in the system's buffer) I've updated the last Intel BIOS without succesful result. I think the disk is working fine, all benchmarks with the hard disk are so good in my new machine as in the old. Thanks in advance for any help. Here the program: #include "stdafx.h" #include stdio.h #include io.h #include windows.h int main(int argc, char* argv[]) { FILE *m_file; unsigned long i; HANDLE hfile; m_file = fopen ("testf", "r+b"); if (!m_file) m_file = fopen ("testf", "w+b"); if (!m_file) return 1; hfile = (HANDLE) _get_osfhandle (_fileno (m_file)); for (i=0; i 20000;++i) { fwrite ("d", 1, 1, m_file); FlushFileBuffers (hfile); } return 0; } Old machine: 2 seconds. New machine: 20 seconds. |
#2
|
|||
|
|||
if im not mistaken, the standard guarentees all file handles to be closed
upon program exist, and subsequently all buffers will be flushed. "Pedro Salazar" wrote in message om... Hi, I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. Same system (Windows 2000), same installed software, same hard disk (IDE), same configuration. I have tried with other hard disks, same result. Note: if I withdraw the FlushFileBuffers function call, I have a little better result in my new machine. I need to use this call or something similar to asure data saving. (at least in the system's buffer) I've updated the last Intel BIOS without succesful result. I think the disk is working fine, all benchmarks with the hard disk are so good in my new machine as in the old. Thanks in advance for any help. Here the program: #include "stdafx.h" #include stdio.h #include io.h #include windows.h int main(int argc, char* argv[]) { FILE *m_file; unsigned long i; HANDLE hfile; m_file = fopen ("testf", "r+b"); if (!m_file) m_file = fopen ("testf", "w+b"); if (!m_file) return 1; hfile = (HANDLE) _get_osfhandle (_fileno (m_file)); for (i=0; i 20000;++i) { fwrite ("d", 1, 1, m_file); FlushFileBuffers (hfile); } return 0; } Old machine: 2 seconds. New machine: 20 seconds. |
#3
|
|||
|
|||
s/exist/exit
if im not mistaken, the standard guarentees all file handles to be closed upon program exist, and subsequently all buffers will be flushed. |
#4
|
|||
|
|||
Pedro Salazar wrote:
Hi, I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. On my Linux machine, it doesn't even compile. Please leave comp.lang.c and comp.lang.c++ off your list of crossposts when discussing platform-specific code. Thanks. -- Richard Heathfield : "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999. C FAQ: http://www.eskimo.com/~scs/C-faq/top.html K&R answers, C books, etc: http://users.powernet.co.uk/eton |
#5
|
|||
|
|||
Pedro Salazar wrote:
I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. Same system (Windows 2000), same installed software, same hard disk (IDE), same configuration. .... snip ... #include "stdafx.h" ^^^^^^^^ Unknown file #include stdio.h #include io.h ^^^^ Non standard file #include windows.h ^^^^^^^^^ Non-standard file int main(int argc, char* argv[]) This is neither a C nor a C++ program, as defined for those newsgroups. They deal ONLY with ISO standard, fully portable, programs. Follow-ups set. -- Chuck F ) ) Available for consulting/temporary embedded and systems. http://cbfalconer.home.att.net USE worldnet address! |
#6
|
|||
|
|||
Pedro Salazar wrote:
I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times [longer] to complete than in my older machine with 1.7GHz, D850MV. Same system (Windows 2000), same installed software, same hard disk (IDE), same configuration. I have tried with other hard disks, same result. Note: if I withdraw the FlushFileBuffers function call, I have a little better result in my new machine. But not TEN times better? I need to use this call or something similar Like fflush(m_file) to [en]sure data saving (at least in the system's buffer). I've updated the last Intel BIOS without successful result. I think the disk is working fine, all benchmarks But *not* hard disk drive benchmarks? with the hard disk are [as] good in my new machine as in the old. Thanks in advance for any help. Here the program: #include "stdafx.h" #include stdio.h #include io.h #include windows.h int main(int argc, char* argv[]) { FILE* m_file = fopen("testf", "r+b"); if (!m_file) m_file = fopen("testf", "w+b"); if (!m_file) return 1; HANDLE hfile = (HANDLE)_get_osfhandle(_fileno(m_file)); for (unsigned int i=0; i 20000;++i) { fwrite("d", 1, 1, m_file); FlushFileBuffers(hfile); } return 0; } Old machine: 2 seconds. New machine: 20 seconds. There is *nothing* wrong with the above program (except that you write one character at a time to your disk drive). Most probably, you haven't configured your new system to take advantage of the disk cache the way that your your old system did. |
#7
|
|||
|
|||
|
#8
|
|||
|
|||
Richard Heathfield wrote in message ...
Pedro Salazar wrote: Hi, I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. On my Linux machine, it doesn't even compile. Please leave comp.lang.c and comp.lang.c++ off your list of crossposts when discussing platform-specific code. Thanks. Thank you too, I was hoping someone with experience in C and Windows 2000 could give me another way to get the same result. If this is not the place to search that advice please tell me where. Thanks. |
#9
|
|||
|
|||
In article , psalazar@datatec-
ec.com says... Richard Heathfield wrote in message ... Pedro Salazar wrote: Hi, I have a new machine with Intel Desktop Board D865GBF. 3GHz. A simple program like this (I explain later) takes TEN times more to complete than in my older machine with 1.7GHz, D850MV. On my Linux machine, it doesn't even compile. Please leave comp.lang.c and comp.lang.c++ off your list of crossposts when discussing platform-specific code. Thanks. Thank you too, I was hoping someone with experience in C and Windows 2000 could give me another way to get the same result. If this is not the place to search that advice please tell me where. Thanks. Something in the comp.os.ms-windows.* hierarchy is a good place to start. -- Randy Howard 2reply remove FOOBAR |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
my new mobo o/c's great | rockerrock | Overclocking AMD Processors | 9 | June 30th 04 08:17 PM |
Machine seems slow. | [email protected] | General | 12 | January 20th 04 12:13 PM |
MSI Ti 4200 8x Slow DirectX 8 performance..Help! | [email protected] | Nvidia Videocards | 0 | August 1st 03 08:57 PM |
MSI Ti 4200 8x Slow DirectX 8 performance..Help! | [email protected] | Nvidia Videocards | 1 | August 1st 03 08:39 PM |
Hard drive that boots elsewhere refuses to boot in this machine | Simon O'Connor | General | 9 | July 22nd 03 06:34 AM |