RE: petes asm.e question.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hayden McKay wrote:
> 
> I was trying to replace my fastfile.e lib with an assembly routine to see
> if I could get some extra speed. the filename buf and the read/write buf
> pointers are placed in ds:dx. The fastfile.lib is currently on par with
> Euphoria's read/write routines. I was just looking for some extra speed.
> I use it frequently to load in "intelhex" format records and other data
> that can be modified then written back out to disk with not much effort.
> n.b. I use "int #21" to call dos interrupt useing the july/9/2000 ver from
> Alexander's mini debugger.

Unfortunately, I doubt you'll be able to beat Euphoria on file io.
The overhead for peeking and poking the sequence of data into memory
before calling the interrupt is where the most of your time is spent.
Optimizing the interrupt call into assembly isn't going to do any
good.

There are a few places in your code where I think you can get some
performance gains though.

In fast_read, find out the length of the file first, then make your
data sequence that length before reading any data.  Put the peek'ed
sequence into data using a slice:

data[index..index+status[REG_AX]-1] = peek({buffer, status[REG_AX]})
index += status[REG_AX]

The same goes for fast_write:

if bytesin > 32768 then
  bytesout = 32768
else
  bytesout = bytesin
end if

poke(buffer, data[index..index+bytesout-1])
index += bytesout
bytesin -= bytesout

In both cases, the variable index should start at 1 outside the loop.

Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu