Questions on Speed of Execution
I am very new to C but have written a program in C with quite a lot of inline assembly code as speed is crucial. I am using QuickC version 2.51 which is a very old DOS based program but run in an easy to use visual interface. It produces DOS code which then runs in a DOS window.
The innermost loop executes about 50 instructions on each pass of which 25 are C instructions and 25 are asm. On my 266Mhz Pentium running windows 98 I find that this loop runs at the rate of about 1M passes per sec. This corresponds nicely with my perception of C and asm speeds ( an asm "instruction" being about 10 times quicker than a C "instruction", say 300M per sec as opposed to 30M per sec for C - but I have reached the limit of replacing C code with asm ) When I run this code on my other machine which is a 800MHz Pentium under win2000 professional I find it runs at 3M per sec which is exactly in accord with my expectations ( the processor is three times quicker and the program runs three times quicker - no surprise so far )
Now for the crunch. I recently tried the program on a new 1.8GHz machine running Windows XP and to my surprise it ran at 3M per sec! In other words no increase in speed. Now I appreciate it is easy to say that Win XP is slow but reviews suggest that it is based on win2000 anyway and is quicker for many aplications.
Now the questions. My program is pure computation - there is no output to devices - it just sits and calculates for days at a time. Nor is there much RAM memory accessing. There is no disk accessing. The total program is about 1,300 lines long and compiles to a 70K exe file but I would not imagine that is particularly relevant. So
Q1. Why is there no speed increase under win XP?
Q2. Would compiling the program on a win based compiler make it run faster?
Q3 Would it be quicker written in C++ or in a 32 bit word version of C or any other version of C?
Q4 Any other comments or suggestions as to how to make it run faster on a newer machine? Or on an older machine for that matter!
Many thanks in anticipation