CONUNDRUM.

A.N.Kuznetsov (kuznet@ms2.inr.ac.ru)
Wed, 12 Feb 1997 20:46:48 +0300 (MSK)


Hello!

I'd like to propose a funny conundrum.

History.

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:

CONUNDRUM

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 ftp.inr.ac.ru:/CONUNDRUM.

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.