C compiler that creates lightweight executables
I am currently using MSVC for C ++, but as I move to C to write a very work-intensive program (interpreter), I have to look for a suitable C compiler.
I have looked at some of the binaries that Turbo-C generated, and even if they are old they seem to be quite tense and optimized.
Now I don't know what is the best compiler for building an interpreter, but maybe you can help me. I've reviewed GCC, but since I don't know much about it, I can't be sure.
source to share
If I were you, I would take an approach of worrying less about the compiler and more worrying about your own code. Write the code for the translator in a sensible way. Then profile it and optimize the points based on how long they take. This is more likely to provide a performance advantage than using a specific compiler.
source to share
If you want a lightweight program, you don't need to worry about the compiler, as the code you write and the libraries you use. Most compilers will get similar results from the same source code.
For example, using C ++ with MFC, the main Windows application used to start is around 900K and growing rapidly. Linking with dynamic MFC-dlls will take you several hundred KB. But by dropping MFC entirely - using the Win32 API directly - and using a minimal C runtime, it was relatively easy to implement the same thing in an .exe file of about 25kB or less (IIRC is a long time ago since I did it).
So, go into libraries and go back to proper C (or even C ++ if you don't use too many smart functions) and you can write very compact applications easily.
change
I just realized I was puzzled by the title of the question, talking about lightweight applications rather than focusing on performance, which seems to be the real issue. If you want performance, then there is no particular need to use C or go into a painful development environment - just write good, high-performance code. Basically, it's about using the right constructs and algorithms, then profiling and optimizing the resulting code to eliminate bottlenecks and inefficiencies. Note that you can make a lot of buzz for your dollar these days by switching to a multithreaded approach rather than just focusing on optimizing your source code - make sure you make good use of the hardware.
source to share
You can use GCC via MingW , Eclipse CDT, or one of the other Windows ports. You can optimize for executable size, executable execution speed, or compilation speed.
source to share
C ++ was designed to be backward compatible with C. So any C ++ compiler should be able to compile pure C. You might want to say that it is C, not C ++, so the compiler does not do name processing, etc. .d. If the compiler is very good with C ++, it should be equally good or better with C, because C is much simpler.
I suggest sticking with MSVC. This is a very decent system. Although, if you're not sure, compare your options. Build the same program with multiple compilers, look at the assembly they produce, measure the final executable performance, etc.
source to share