www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/06/12/11:58:57

Date: Thu, 12 Jun 1997 18:57:05 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: djgpp-workers AT delorie DOT com
Subject: Re: suggestion for moving DTA to fixed place in __tb
In-Reply-To: <339FF899.5D7@rug.ac.be>
Message-ID: <Pine.SUN.3.91.970612184822.9257g-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019