1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CLS /C slow on Win7

Discussion in 'Support' started by vefatica, Sep 22, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,129
    Likes Received:
    33
    Has anyone else noticed that "CLS /C" is significantly slower in Win7 than in XP? For a 9999-line console screen buffer the difference here is .61 second vs. .22 second. Is this because of the new console model in Win7?
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,090
    Likes Received:
    85
    Haven't noticed. All CLS /C does is call FillConsoleOutputCharacter and
    FillConsoleOutputAttribute, so any timing difference would be in the console
    API handling.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,129
    Likes Received:
    33
    On Thu, 22 Sep 2011 13:13:31 -0400, rconn <> wrote:

    |---Quote---
    |> Has anyone else noticed that "CLS /C" is significantly slower in Win7
    |> than in XP?
    |---End Quote---
    |Haven't noticed. All CLS /C does is call FillConsoleOutputCharacter and
    |FillConsoleOutputAttribute, so any timing difference would be in the console
    |API handling.

    The "space" key in the middle of my Gateway2000 Anykey keyboard's 8-arrow-key
    array has been programmed to "C-L-S-Enter" for about 20 years. And for about 10
    years I've had "alias acls=*cls /c". I press that key a lot, usually after "a".
    The difference in how fast it works (Win7 vs. XP) is striking.
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,129
    Likes Received:
    33
    Hmmm! I dunno. As I said, it takes .61 second for an 80 x 9999 console.

    I can do it with a plugin in 0:00:00.00.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,090
    Likes Received:
    85
    Doubtful, because you can't do it with a single call. (The API doesn't work
    if you try to do more than 64K.)
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,090
    Likes Received:
    85
    CLS /C takes 0.10 seconds on my system with a 200 x 10,000 display.
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,129
    Likes Received:
    33
    On Fri, 23 Sep 2011 01:18:42 -0400, rconn <> wrote:

    |---Quote---
    |> I can do it with a plugin in 0:00:00.00.
    |---End Quote---
    |Doubtful, because you can't do it with a single call. (The API doesn't work
    |if you try to do more than 64K.)

    I remember such a limitation for some console APIs, but the docs for
    FillConsoleOutputAttribute and FillConsoleOutputCharacter (VS2008/2010) don't
    mention it. And it doesn't seem to be the case. The code I'm using (below,
    built with VS2008) works in a 80 x 9999 buffer (and a 157 x 9999 buffer in .01
    sec). In testing, I first fill up the buffer with a few "DIR /s c:\"s and check
    that it has been cleared entirely (it has, on both XPSP3 and Win7SP1).

    Code:
    INT WINAPI FASTCLS ( WCHAR *psz )
    {
    	CONSOLE_SCREEN_BUFFER_INFO csbi;
    	DWORD dwWritten;
    	COORD cdZero = {0, 0};
    
    	GetConsoleScreenBufferInfo(STD_OUT, &csbi);
    
    	FillConsoleOutputAttribute(STD_OUT, csbi.wAttributes,
    		csbi.dwSize.X * csbi.dwSize.Y, cdZero, &dwWritten);
    
    	FillConsoleOutputCharacter(STD_OUT, L' ',
    		csbi.dwSize.X * csbi.dwSize.Y, cdZero, &dwWritten);
    
    	SetConsoleCursorPosition(STD_OUT, cdZero);
    
    	return 0;
    }
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,129
    Likes Received:
    33
    On Fri, 23 Sep 2011 01:18:43 -0400, rconn <> wrote:

    |---Quote---
    |> I can do it with a plugin in 0:00:00.00.
    |---End Quote---
    |CLS /C takes 0.10 seconds on my system with a 200 x 10,000 display.

    For me it's still .61 sec with 157 x 9999. I have 4 x 2.66Ghz and a rather
    pedestrian NVIDIA Quadro FX570.
     

Share This Page