Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Testers needed (benchmarking 'b64') (Miscellaneous)

posted by Rugxulo Homepage, Usono, 19.08.2012, 03:25

> Okay, but I'm not sure why OW is so slow.

I could be wrong, but I think it's because of BUFSIZ being default of only 512 bytes for 16-bit code.

When I added two calls to setvbuf() using two char [16000] arrays, one for input and one for output, then it sped up. And I compiled with "wcl /otexan". Feel free to benchmark this too, if curious.


--- b64.c       2012-08-13 07:45:52 +0000
+++ b64_me.c    2012-08-18 20:17:32 +0000
@@ -215,6 +215,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+static char my_inbuf[16000], my_outbuf[16000];
+
 /*
 ** Translation Table as described in RFC1113
 */
@@ -400,6 +402,7 @@
     }
     else {
         infile = fopen( infilename, "rb" );
+        setvbuf(infile,my_inbuf,_IOFBF,sizeof my_inbuf);
     }
     if( !infile ) {
         perror( infilename );
@@ -411,6 +414,7 @@
         }
         else {
             outfile = fopen( outfilename, "wb" );
+            setvbuf(outfile,my_outbuf,_IOFBF,sizeof my_outbuf);
         }
         if( !outfile ) {
             perror( outfilename );


(clean boot)
C:\TMP\BLAH>runtime b64_me -e douay.txt me.out
03.41 seconds elapsed
C:\TMP\BLAH>runtime b64_ow -e douay.txt rr.out
10.77 seconds elapsed

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 302 users online (1 registered, 301 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum