News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Displayng stuff on the console: 7 millions CPU cycles

Started by frktons, January 15, 2013, 11:41:27 AM

Previous topic - Next topic

frktons

Well your app does a lot of things, and is best suited for displaying
long text files. What I'm going to do is something completely different,
so we cannot compare the two. But I need something faster than loc
and print so that's my goal for the time being.
Now I'm going to sleep,  :dazzled: tomorrow maybe I'll start coding.
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

dedndave

i didn't even think about it - lol
that thing is sending text across WM_COPYDATA to the other window   :lol:

change the UserCode.inc file like this....
UsrCode PROC

push edi
mov edi,1000
loop00:
uPrint chr$('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
dec edi
jnz loop00
pop edi

        call    TestComplete
        ret

UsrCode ENDP

(notice uPrint instead of dPrint)

it's about twice as fast - 18000 chars per second

frktons

Quote from: dedndave on January 15, 2013, 02:50:40 PM
it's about twice as fast - 18000 chars per second
That's a good gain. I have to admit that my preliminary tests give me a rate of
about 4 millions chars per second. But you know...  :P

My PC is a Core Duo, 3-4 light years younger and faster than yours.  :lol:
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

dedndave


frktons

There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

frktons

OK, I have modified the prog to display 4 million chars on the
console screen, and it takes a little bit more than 1 second.

Attached the version with CALL Display4M
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

jj2007

3e9 cycles here :t
Now you need to add scrolling, too...

frktons

Quote from: jj2007 on January 16, 2013, 12:39:02 AM
3e9 cycles here :t
Now you need to add scrolling, too...

I guess 3e9 cycles means 3*10^9 = 3 billions = 3 Ghz = more or less 1 second.

If I correctly remember, the console buffer cannot exceed 64K, so
the "4 Million chars test" is out anyway.

To have a scrollable 64K buffer, it's enough to fill the 64K buffer,
and allocate the console without fixed dimensions, displaying
on the console the first 4000 chars, authomatic scrollbars will do the rest.
That's more or less the solution I'm thinking about.

A more complex solution, with a buffer up to 2 Gb, a fixed lenght console
screen and console screen buffer of 4000 chars, and WriteConsoleOutput,
or WriteConsoleOutputCharacter to display 4000 chars at a time, using
arrow keys to scroll through the buffer, or PgUp/PgDown to scroll it a page
at a time, and so on.

Both solutions are different from Dave's one, and the latter takes quite a
lot more code and time to work properly. Considering I don't actually need
them, it could only be another [of thousand] deviation from the main goal:
Text File Compressor & Scan.

Well a routine to display the text file to compress or the uncompressed one
could be useful... I'll think about it.

There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

dedndave

yah - let's say they were different characters, though
let's be realistic   :P

Adamanteus

I could say some remarks, because this topic seemed free of practical concepts :
1. example PrintTestFormat2 not count presence of LOCALE_SGROUPING, from this follow that this operation much better perfom on string number
2. output 400,000 chars on console better simply preserve by program options, that to get minimal need or output such amount to file straight
3. console output on national code pages sometime require ansi to oem conversion, that slow this even more

So, decision seemed to improve algorithm and not output unneed information on console at all.

frktons

Quote from: Adamanteus on January 16, 2013, 10:04:28 PM
I could say some remarks, because this topic seemed free of practical concepts :
1. example PrintTestFormat2 not count presence of LOCALE_SGROUPING, from this follow that this operation much better perfom on string number
2. output 400,000 chars on console better simply preserve by program options, that to get minimal need or output such amount to file straight
3. console output on national code pages sometime require ansi to oem conversion, that slow this even more

So, decision seemed to improve algorithm and not output unneed information on console at all.

1] The LOCALE_SGROUPING is used per default = 3, sorry for countries with
different LOCALE_GROUPING that I'm not interested to manage.
2] It was just a joke between Dave and me. It's difficult to find a real life case
in which you have to display 4 million chars at a time.
3] That is included. Look at the source.

Enjoy

Frank
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama