Article View: comp.sys.atari.st
Article #36090Re: A quick NULLFILL question
From: Leo de Wit
Date: Sat, 21 Jan 1989 18:19
Date: Sat, 21 Jan 1989 18:19
52 lines
2457 bytes
2457 bytes
In article <873@cacilj.UUCP> paul@cacilj.UUCP (Paul Close) writes:
|I was happy to see that the NULLFILL recently posted actually clears the BSS.
|My question is, if the clearing routine is so fast, why not just clear
|everything and make ALL programs happy? After all, what's a few milliseconds
|among friends?
When you have a *LOT* of Ram, clearing this still takes a non-trivial
amount of time (estimation: about 1 sec per 4M). On a 1M machine
however the difference would be hardly noticeable, so this would be a
good compromise.
A standard trick that can be used on systems that have lots of memory,
is to install a large RAM disk, so that perhaps only one M is free.
This has the additional advantage that you can load all your standard
tools onto the RAM disk, again speeding up you system.
|I'm not familiar with the source code--could someone give me pointers on how
|to clear the heap and stack, etc. like TOS does? (except using the fast
|nullfill routine, of course.)
Easy enough. Change the line
move.l -58(a6),d0 * # bytes to fill: BSS size
into
move.l -46(a6),d0 * # bytes to fill: BSS, heap & stack
and.l #$fffffffc,d0 * Truncate to multiple of 4.
The second instruction is probably not necessary; I used it since
GEMDOS clears using longwords (the remainder mod 4 is discarded).
Some timing figures on a 520 ST+ (a 1M machine for those who don't
know), running a small ( < 2K) program:
standard GEMDOS: 1.850 sec.
fast nullfill (all): 0.540 sec. (nullfill with the above modification)
fast nullfill (bss): 0.340 sec.
The actual run took 0.010 sec.; the estimated program load time (from
hard disk) is thus 0.330 sec (the program contained no BSS), system
overhead not taken into account. Running from RAM disk the figures
will become even more interesting.
Minor correction on John Zafiris modifications:
move #20*20+1,d0
should probably be
move #20*20-1,d0
,since a DBcc counts down until -1 (or until the cc holds). There are
two such lines.
Leo.
Technical Details
Message-ID:
<927@philmds.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!philmds!leoReferences:
<873@cacilj.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: Re: A quick NULLFILL question Message-ID: <927@philmds.UUCP> Date: 21 Jan 89 18:19:46 GMT References: <873@cacilj.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 52