News:

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

Main Menu

Genuinely fast character class app with a remote table SLL

Started by hutch--, February 23, 2022, 11:17:30 AM

Previous topic - Next topic

hutch--

The app is designed to scan a text file and produce a count of character classes. It creates a character stream, passes each character to a remote character table to determine its character class then increments an array of class members to produce a count of character classes.

The only problem with the app is that it is so fast that its hard to get a timing with it when passing ordinary text file to it.

Now if you treat PowerBASIC compilers as what they are, high powered industrial compilers, you don't have to suffer being mislead or bullied into mediocre solutions, if you can write it, you can compete in the big league against anything.

With this app, the action is in the six (6) instruction loop.

  ' ********************
  ' set up a byte stream
  ' ********************
  lpst:
    ! add esi, 1
    ! movzx eax, BYTE PTR [esi]             ' zero extend byte into eax
    ! movzx eax, BYTE PTR [ecx+eax]         ' get the byte class from the remote table
    ! add DWORD PTR [edi+eax*4], 1          ' increment each DWORD array member
    ! sub lstr, 1
    ! jnz lpst
  ' ********************

I would like to thank Ross Boyd from the PowerBASIC forum for his suggestions and code testing. A pleasure to work with someone who understand the virtue of chasing fast code.

Gunther

Steve,

this is indeed impressive: 6 lines with PB's inline assembler. Rock solid.  :thumbsup:
You have to know the facts before you can distort them.