>
>
> Has anyone else noticed that at the end of extracting a binary in
> Nuntius the disk light comes on, stays on for a few seconds, and
> freezes the Mac for that duration? It gets unbearable if you have
> a large disk cache, but even with only a 256K cache it can freeze
> the Mac for up to 5 seconds.
>
>
This is not the fault of Nuntius -- many other programs like BinHex
decoders, uudecoders, archive expanders etc. seem to suffer the same
problem.
This really annoys me. One of the good features of Nuntius is the way
it lets you continue working while it is doing other things in the
background, so having it freeze like this is particularly galling.
The problem is that Nuntius (and other programs) write their data to
disk in chunks (say 4K each) and the Mac caches the blocks in its disk
cache. When the file is closed the data is finally written to disk,
and this is what causes the big freeze up. It would be much better if
the data were written continually to disk, instead of in one big burst
at the end.
Yesterday morning I wrote a little INIT which sets the File Manager
"don't cache" bit for disk writes of 1K or more. It does this by
installing the following patch on the _Write system call:
tst.w IOParam.ioRefNum(a0) ; Is this a file write?
bmi.s @sys_write
cmp.l #1024, IOParam.ioReqCount(a0); Is it at leask 1K?
blo.s @sys_write
ori.w #0x20, IOParam.ioPosMode(a0) ; Set "Don't cache" bit
extern sys_write:jmp 0x12345678 ; Resume the system call
One surprising artifact of this is that it not only amortises the disk
time over all the writes, but it also makes it 25 times faster.
What?
Yes, it's true.
I set my disk cache to 768K, and wrote a test program which wrote to a
file in 32 blocks of 16K each, making a total of 512K.
Without the INIT, the writes took almost no time, but the Close call
took 11 seconds, averaging about 45K/second write rate.
With the INIT, the whole thing took under half a second, averaging
over a megabyte per second.
Go figure.
This may not make much difference to people connecting over modem, but
for people on Ethernet it makes a huge difference.