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;usesDos;typetRec= recordid: Longintend;varF: file of tRec;r: tRec;t0: Real;i,j: Longint;constfn= 'ioprftst.dat';N= 1000000;M= 1000000;function t: real;varh,m,s,s100: word;begingettime(h,m,s,s100);t:= s100/100.+s+m*60.0+h*3600.0-t0;end;procedure log(const msg: string);beginwriteln(t:7:2,':',msg);end;beginwriteln('IO Performance Test');t0:= 0; t0:= t;log('start');assign(f, fn);rewrite(f);log('writing values...');for i:= 0 to N-1 dobeginr.ID:= i;write(f, r);end;log('done');log('reading values...');for j:= 0 to M-1 dobegini:= 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.