Mail Archives: djgpp-workers/1997/06/12/11:58:57
On Thu, 12 Jun 1997, Vik Heyndrickx wrote:
> themselves, nearly a quarter of all DOS interrupts is to set the DTA
> address (int 21-1Ah), over and over again to the same address. I've seen
> in the sources that only the [_dos_]find[first|next] routines do this.
I'd guess that this is because these programs call `stat' extensively.
`stat' calls `findfirst' to get most of the info; sometimes it calls
`findfirst' more than once (when the file doesn't exist).
Unix programs just *love* `stat', even when `access' would do the job,
because `stat' is a simple OS call in Unix.
> Since calling interrupts is a bit cumbersome under a DPMI host, I
> believe a task switch is involved, the total of may times almost now
> time equal some time.
Yes, but some profiling data would be nice. I have found that unless a
program calls `stat' hundreds of times, it is not worth our while to
optimize `stat'. Personally, I find it hard to believe that SetDTA call
is eating up any significant amount of cycles, relative to other
disk-related functions.
Btw, `stat' has much heavier parts that the SetDTA call.
> So, why don't we set the DTA address to the start of __tb in crt1.c and
> leave it there for the rest of the program?
This is just more dangerous, due to child programs, programs that crash
or exit abnormally and don't reset the DTA to its previous address, etc.
- Raw text -