Announcement

Collapse
No announcement yet.

Speed comparison of writing text on a console screen with a Windows graphic screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Speed comparison of writing text on a console screen with a Windows graphic screen

    I have been using the Console Compiler for years, and have developed several large programs in the evolutionary biology field that are used by several other researchers. Even though the programs have mouse support, menus, list boxes etc., there is still a lot of resistance to using the program because it lacks a standard Windows GUI, and I do agree that having callback would greatly increase ease of use for certain menus.

    I can easily convert all the dialogue boxes, list boxes etc over to Windows, and certainly the new version 9 of the Windows compiler looks very attractive doing this with its built in functions for the user interface. One thing that holds me back is uncertainty about whether writing to a Windows graphics screen would ever be as fast as writing to the console screen. I have been using the functions WriteConsoleOutputCharacter and FillConsoleOutputAttribute in PBCC programs to directly print characters to the screen (as a result of all the original problems with slow printing to standard sized console boxes), and this is very fast. I need to create large character-based displays (actually of nucleotide sequence data, typically 150 x 250 character screen sizes) as part of a sequence editor, and I'm not really sure whether writing text to a Windows box would be feasible - moving around a sequence alignment requires very fast screen re-drawing, and the program is painful if it slows up.



    Here is a typical sequence editor screen created from a PBCC program that needs to converted to a Windows graphics screen.

    Sorry in advance if this post seems strange or stupid!

    Peter
    Last edited by Peter Simmonds; 11 Nov 2008, 07:11 AM. Reason: iMAGE DIDN'T DISPLAY

  • #2
    Peter,
    don't worry about it. I can rewrite and display a graphic window that size, full of printed text, at a rate of about 100 full screens per second. I imagine you'll only need 10 screens per second as anything faster is just a blur.

    Paul.
    Edit:
    Although the 100 screens per second is correct, that was for plain text. To individually colour each character as you appear to need, slows this to about 7 full screens per second.
    Last edited by Paul Dixon; 11 Nov 2008, 08:58 AM.

    Comment


    • #3
      My goodness, Paul, for a moment there I thought you were going to commit heresy and suggest actually TRYING it.

      Thank goodness you did it for him. Whew!
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Michael

        Well, if I had a few hundred dollars lying around to buy PB-Win9 I certainly would be able to try, but I don't.

        I really need to make sure that that moving over my programs to PB-Win is going to feasible before paying out the money!

        Peter

        Comment


        • #5
          ...a lot of resistance to using the program because it lacks a standard Windows GUI...
          That is a really sorry state of mind. Eye-wash over functionally.

          Maybe you could ask PB or somebody else to compile your program and send you the .EXE back to see if it meets your expectations. I would except, like you, I don't have PB9.
          There are no atheists in a fox hole or the morning of a math test.
          If my flag offends you, I'll help you pack.

          Comment


          • #6
            Mel, the slight problem with that is I have never written a Windows program before, so I would have to do a few little programming experiments first!!

            I do agree about the interface, can't quite see why it is so difficult for people to use, it has a standard menu bar, drop down menus, full mouse support....

            Peter

            Comment


            • #7
              Mel,
              GRAPHIC WINDOW exists in PBCC4 and I can still print text on the screen in any colour at any position many times a second.

              Paul.

              Comment


              • #8
                I'm aware of that Paul but Peter was talking about conversion from CC to win.

                Peter, Ohhhhh!!! Missed that little point. Apologies.

                Added: Now all we need is Mary to chime in here and we'll have a full rock group.
                There are no atheists in a fox hole or the morning of a math test.
                If my flag offends you, I'll help you pack.

                Comment


                • #9
                  Mel,
                  I thought Peter was asking if he moved to PB/Win then would drawing this information to a graphic screen instead of a console screen be fast enough.

                  Paul.

                  Comment


                  • #10
                    Peter,
                    this code runs in PBCC4. It opens a graphic window big enough to display 250x150 characters (way bigger than my screen will show) and it updates every character individually on each pass.
                    This should be the worst case for your code as updating just a few things will take less time and updating a block of text (same colour) is faster than doing each character.

                    On my PC it runs in 4 to 5 screens per second.
                    Less rows or less columns will be faster. Your sample screen shown above is only about 70 x 130 characters which updates at 16 screens full per second.

                    Paul.
                    Code:
                    'PBCC4 program
                    FUNCTION PBMAIN () AS LONG
                      
                    'fill up some array with dummy data to display
                    DIM a$(256,1000)
                    FOR r& = 1 TO 100
                        FOR t&=1 TO 1000
                            a$(r&,t&)=STRING$(250,RND(65,126))
                        NEXT
                    NEXT
                    
                    GRAPHIC WINDOW "Graphics", 1, 1, 2020, 2400  TO hWin???     '2020 x 2400 gives 250 x 150 characters
                    GRAPHIC ATTACH hWin???, 0, REDRAW
                    GRAPHIC FONT "Courier New",10,0
                    
                    t1##=TIMER
                    cnt&=0
                    DO
                        FOR d& = 1 TO 10
                            INCR offset&
                            offset&=offset& AND 63
                            FOR WhichLine& = 1 TO 150
                                'move to start of line
                                GRAPHIC SET POS (1,WhichLine&*16)
                    
                                FOR c& = 1 TO LEN(a$(offset&,Whichline&))
                                    'draw each chracter in this line
                                    GRAPHIC COLOR RND(1,&h7fffff),%BLACK
                                    GRAPHIC PRINT MID$(a$(offset&,Whichline&),c&,1);
                                NEXT
                            NEXT
                            GRAPHIC REDRAW  'update the screen
                            INCR cnt&
                        NEXT
                        PRINT cnt&/(TIMER-t1##);"screens full per second"
                        t1##=TIMER
                        cnt&=0
                    LOOP UNTIL INSTAT
                    GRAPHIC WINDOW END
                    END FUNCTION

                    Comment


                    • #11
                      Paul

                      that's great, but just to check, can we assume that printing text to a Windows box (that needs to capture keyboard and mouse events) be equivalent in speed to the graphics window in PBCC.

                      Peter

                      Comment


                      • #12
                        Originally posted by Peter Simmonds View Post
                        Paul

                        that's great, but just to check, can we assume that printing text to a Windows box (that needs to capture keyboard and mouse events) be equivalent in speed to the graphics window in PBCC.

                        Peter
                        Hi Peter,

                        While I *haven't* done it in pb - I did it in c++ using the mfc library - you can have that screen blur. Basically (at the time) I was writing directly to the "device context" as I remember. So SDK programming will get you what you want .

                        The other thing you could try is the Console Tools library (or console tools plus graphics) from PerfectSynch. That might do exactly what you want.

                        John
                        John,
                        --------------------------------
                        John Strasser
                        Phone: 480 - 273 - 8798

                        Comment

                        Working...
                        X