First post, by bn
Hi,
I have a DOS database application that uses flat files for data storage which is extremely fast on native DOS and NTVDM under Windows and very slow under DOSBox. I could track it down to the basic file I/O being slow in DOSBox and I hope that this is the right forum to raise this issue.
I have written a simple Pascal test program (source code below, exe available on request) that writes a sequence of 1 million 4byte integers to a file and then reads them back randomly 1 million times. Under NTVDM, times are 4 seconds for writing and 8 seconds in total. Under DOSBox, times are 19 seconds for writing and 67 seconds in total.
There is not much variation in the figures even when I use very different DOSBox settings. The results apply both for local disk access and network shares.
Any idea where to look for reasons for the slow performance?
Best regards,
Boris
program IOPerfTest;
uses
Dos;
type
tRec= record
id: Longint
end;
var
F: file of tRec;
r: tRec;
t0: Real;
i,j: Longint;
const
fn= 'ioprftst.dat';
N= 1000000;
M= 1000000;
function t: real;
var
h,m,s,s100: word;
begin
gettime(h,m,s,s100);
t:= s100/100.+s+m*60.0+h*3600.0-t0;
end;
procedure log(const msg: string);
begin
writeln(t:7:2,':',msg);
end;
begin
writeln('IO Performance Test');
t0:= 0; t0:= t;
log('start');
assign(f, fn);
rewrite(f);
log('writing values...');
for i:= 0 to N-1 do
begin
r.ID:= i;
write(f, r);
end;
log('done');
log('reading values...');
for j:= 0 to M-1 do
begin
i:= trunc(random*M);
seek(f, i); read(f, r);
if r.ID<> i then log('error!');
end;
log('done');
close(f);
log('end');
readln; { Enter to finish }
end.