Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This week I could optimize using a reduced C library that allowed a drastic shrinkage in code size - from about 60 K to about 6 K and then we could load the code in the 8 K on-chip memory of an FPGA (Altera DE2) which I suppose is SRAM so there is SRAM both on-chip and off-chip(?)

The program was rather small itself and we noticed that most of the size was from libraries and doing embedded system we reduce the libraries to only what is needed so that the footprint is minimized.

It makes me wonder about something I heard in the media which was a story, maybe fictious, that Microsoft had to deliver a C compiler in only 20 K or so in the 70s or early 80s when there was not much memory available for software, is it true? What is a feasible size of the footprint for a small C compiler?

share|improve this question
4  
You may wish to investigate an existing project such as bellard.org/tcc –  Greg Hewgill Oct 11 '13 at 4:32
    
I'm not sure about how legit Microsoft's story is, but this should give you an idea on how small the first c compiler is github.com/mortdeus/legacy-cc . its around 50K for the source, might be smaller once compiled. –  Maru Oct 11 '13 at 4:45
2  
The size of the compiler has nothing to do with the size of the binaries it generates, which seemed to be your problem (unless you're putting the compiler on the fpga) –  James Oct 11 '13 at 8:19
1  
use the optimization setting for space instead of for speed –  ratchet freak Oct 11 '13 at 8:45
add comment

1 Answer

up vote 3 down vote accepted

The Software Toolworks C compiler for CP/M came on one 8" SSSD floppy, and compiled most of the language as of about 1982. It required a machine with 56K of memory and one floppy drive. I don't remember how much the resident portion of CP/M required.

Turbo Pascal 1.0 required 64K on a CP/M machine, and included an IDE. It was a single-pass compiler, written in heavily-optimized assembly language, and did EVERYTHING in RAM, making it BLINDINGLY fast. (Bill Gates was reportedly NOT happy about it: it made Microsoft look really bad.)

share|improve this answer
    
I remember Turbo Pascal 1.0. It compiled in 10 seconds a program I wrote that took 10 minutes to compile on an Apple IIe using the Apple Pascal compiler. –  Robert Harvey Oct 11 '13 at 5:46
    
Says a lot, if you think about it: the authors of Turbo Pascal didn't use Pascal inside their compiler. It might be fast, but the code produced clearly wasn't that efficient. –  MSalters Oct 11 '13 at 9:43
    
@MSalters: Well, Pascal as a language wasn't designed specifically for writing compilers. People could still get the same performance that the compiler got by writing their programs the way Borland wrote their compiler, with the accompanying tradeoffs. I think that there is a general sense in the programming community that all languages should be capable of everything, but that's just not reality. FWIW programs written and compiled in Turbo Pascal did perform pretty well. Microsoft's C# compiler is written in C++; the Mono compiler is self-hosting. –  Robert Harvey Oct 12 '13 at 2:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.