www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/02/05:41:30

Newsgroups: comp.os.msdos.djgpp
From: Elliott Oti <oti AT phys DOT uu DOT nl>
Subject: Re: Slooooww Iooooo -- Please help.
Sender: usenet AT phys DOT uu DOT nl (News system Tijgertje)
Message-ID: <Pine.OSF.4.03.9810021109330.27403-100000@ruunf0.phys.uu.nl>
In-Reply-To: <5GVQ1.732$HF3.1567674@news14.ispnews.com>
Date: Fri, 2 Oct 1998 09:23:45 GMT
X-Nntp-Posting-Host: ruunf0.phys.uu.nl
References: <5GVQ1.732$HF3 DOT 1567674 AT news14 DOT ispnews DOT com>
Mime-Version: 1.0
Organization: Physics and Astronomy, University of Utrecht, The Netherlands
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 2 Oct 1998, tom young wrote:

> I am using dos-gcc on Linux to cross-compile my Roth IRA Calculator
> program to MSDOS.   DJGPP is terrific, but for some reason the
> program runs about ten times as fast under Linux as under DOSEMU
> or Windows 95.  Am using gcc-2.7.2.3 and binutils-2.9.1.0.4.

> so, is seems disk and screen IO is a problem, but what is the solution?
> The program reads several small text files and printf's to the screen.
> A typical run is .27 seconds elapsed under Linux and 3 seconds under
> MSDOS.  Hundreds of runs will ultimately be required. 
> 

Linux disk handling is much faster than Dos's; Linux routinely caches
disks, while DOS does not, unless a third party program like SmartDrive
is installed. If you are using the real mode BIOS text IO routines (which
I believe printf calls) then the switching between protected mode and real
mode to service the printf calls is also a cause of much overhead.

Short of installing a disk cache there's little you can do AFAIK to
improve DOS IO speeds. If it is any use, you might want to avoid functions
like scanf() and use fread() to read in small files in one go, into a
char buffer, and parse the buffer instead of the file.

For text output, for your DOS version you might want to write a printf()
clone that writes directly to screen memory at 0xB800 instead of stdout.
Redirection of text output will be impossible, of course, and it will
be a pain if you have to emulate every feature of printf(), but if you're
not bothered by that it will speed up your program.

HTH,

  Elliott Oti
  http://www.fys.ruu.nl/~oti
  Eh? Where's my sig?

- Raw text -


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