top | item 38517062

(no title)

fm77 | 2 years ago

I was quite late to the previous „Happy birthday Turbo Pascal" entry so I repost, @admin: I hope thats ok.

For all who wonder why Turbo Pascal was so fast here some insights: https://news.ycombinator.com/item?id=38477688#38486185

discuss

order

acqq|2 years ago

The link is about the assembly details of the compiler code. But that still misses the point in a few important ways. And I'm not talking about the Turbo Pascals with the numbers 5 or higher, but about the first ones actually used, like the one for CP/M where the OS and the program all have to fit in 64 K. Turbo Pascal was more than a compiler fitting in that space: it contained editor, kept the source of the compiled program completely in RAM, and produced executable with one write to disk and just a few reads.

https://techtinkering.com/2013/03/05/turbo-pascal-a-great-ch...

1) The fact that the author was very used to think in assembly is that he was able to generate a compiler to the native code that even without optimizing passes already "well behaves": not squeezing every drop possible for optimization but also making a lot of optimization passes not necessary. That's the "magic sauce" in being what was called "a single pass."

2) Description "a single pass" is actually somewhat imprecise when used by most who talk about it. The passes through something are necessary in compilers, the actual goal is making once the processing on the levels which hurts the whole compilation process the most.

3) So the major difference between the typical "production" compilers and Turbo Pascal was in later being able to fit "everything" in the RAM between the last edit and the production of the compiled code. If I remember correctly it didn't even have to write anything to the disk if one just needed to run the program(!) Only when one needed the executable the write happened.

So assembly was an important part of the story but at the time most of the professionals used assembly anyway, the speed vas result every other decision was also made to achieve minimal I/O (which also wasn't necessarily unique feature) while also being useful enough for the real programs (that was less unique) and comfortable (Wordstar-keys editor, jump to the error after compilation).

A lot of very good decisions combined, that was special. And finally, comparably cheap, too.