[lkml]   [1997]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread

I'd like to propose a funny conundrum.


One day one user complained that his program executes
much slower (25%) when he runs it in Linux
(vs. compiled by Watcom C under msdos).
Well, I said him something sort of "gcc is well-known crap, cannot help you"
Unfortunately, he appeared to be enough experienced: he took
Watcom C output, disassembled it, assembled back to Linux
executable, and asked:


One binary code executes under MSDOS 17% faster(!) than
under Linux. Why? How to get this loss back? I was dazed&confused.

Note that kernel has nothing to do with the problem.
I tested this program with disabled swapping and
masked interrupts (time is measured by Pentium cpu ticks)

The explanations sort of "It is cache problem" or
"It is TLB trashing" are not accepted.
Bare MSDOS, Windows3.11 and Windows95 show the same (good) result.

You can get the program sources, necessary data,
and msdos binaries at

It prints lines sort of:
Step 0 of 6400 45.917 0
^---------- Time measured by P5 CPU, normilized
to seconds, supposing that CPU clock is 100MHz.
So that, it is seconds only for 100MHz cpu.

For MSDOS I see:
Step 0 of 6400 39.376 0

Do not ask me what this program does, and why
1.dg3 file is so huge. I have no idea.
The only thing that I know is that binary codes
really coincide.

1.dg3.gz - a huge file with obscure data.
dos.tar.gz - dos4gw.exe and test.exe
linux.tar.gz - sources. 3dz2.c is C original.
3dz2.s is 3dz2.c compiled by Watcom C.

Alexey Kuznetsov.

 \ /
  Last update: 2005-03-22 13:38    [W:0.054 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site