Solved

Console output slowdown on Core Duo system versus P4 system

Posted on 2006-10-27
6
229 Views
Last Modified: 2010-04-01
Hi everyone, I have a simple application as written below:

#include <Windows.h> //For Windows API usage
#include <conio.h> //For making the console to stay up after it finishes

int main(int argc, char* argv[]) {
    COORD plotcoord;
    CHAR runChar = '*';
    HANDLE oHandle = GetStdHandle(STD_OUTPUT_HANDLE);
    DWORD cWritten;
    plotcoord.X = 0;

    for (int j= 0; j< 25; j++){
    plotcoord.Y = j;
    for (int i= 0; i< 80; i++){
        runChar = (char) i;
        plotcoord.X = i;
        Sleep(1);
        WriteConsoleOutputCharacter(oHandle, &runChar, 1, plotcoord, &cWritten);
    }
    }
   
    //Press any key to exit, process finishes
    getch();

    //Exit
    return 0;
}


The program runs noticably slower on my Laptop with a Core Duo 2.0Ghz CPU and 1GB RAM compared with my desktop with a P4 2.0Ghz with 1GB RAM.
By slower, I am the speed at which the letters are displayed onto the console.

I am not sure if this is a hardware dependent issue or if I mess up some settings on my laptop OS?
Is there anything that can affect how long the "sleep" command actually sleep for?

Also, FYI, I am using Bloodshed Dev-C++ to compile the file, I am not sure either if I set up anything that could have cause the slowdown.
I tried uninstalling and reinstallng Bloodshed, it still doesnt help.
Also, when comparing the speed, I basically just carry over the exe file and run it on the other system.

Any help will be grealy appreciated.
0
Comment
Question by:ronli_84
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 8

Expert Comment

by:deepu chandran
ID: 17824462
Hi,

There is nothing wrong with your hardware.You have given one millisecond Delay using
Sleep() Function.
You just check after comment that line and run it.It will work very faster.

Deepu
0
 

Author Comment

by:ronli_84
ID: 17824729
I do agree that it works very fast without the comment line.

But my question was why is there a significant difference in the effect of the sleep command from the two machines.
Could the environment affect it? or hardware affecting.
0
 

Author Comment

by:ronli_84
ID: 17831457
anyone know??
0
 

Author Comment

by:ronli_84
ID: 17847672
It looks like it is related to sleep state of the CPU.
The program seems fine by plugging in the AC adapter and forcing full CPU utilization.

Please close the question. Thank you
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
ID: 17877267
Closed, 300 points refunded.
kb
Experts Exchange Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question