Re:Turbo Pascal Turns 40
by rezaprima on Thursday November 30, 2023 @04:35PM
(#38479520)
25 seconds to compile it? How come ?
[ Parent
| on HN ]
Niklaus Wirth (Pascal inventor) had the rule that compiler speed must never regress. So if you add an optimization (which means the compiler has to do more work), the optimization must "pay for itself" and make the compiler faster.
That philosophy probably seeped into Turbo Pascal to some degree.
That’s very interesting. I see similar attitude in the C# JIT/Roslyn developers where they take this very seriously. Interesting are this is influenced by Anders, or just whole thing tick for a lot of compiler developers?
You're saying that the reason for the slow compilation speed we see here is a commitment to keeping the compiler fast. That's not a logical sequence of thought.
Also, Pascal is a direct descendant of a very, very old language (ALGOL-58 from 1958). In the 1950s, HLL compilation was at the extreme edge of what computers were capable of doing and a key goal of language design was (or should have been - cough COBOL cough) to make it as efficient as possible.
By the time Ken Thompson was designing languages, hardware had improved a lot and he could make compilation efficiency a lower priority.
Technically, ALGOL-58 lead to ALGOL-60 which led to ALGOL X (1966) then to ALGOL W (1966) and then to Pascal (1970). X and W were proposals by Nicklaus Wirth and Tony Hoare as successors to ALGOL 60.
Re:Turbo Pascal Turns 40
by giancarlostoro on Thursday November 30, 2023 @04:37PM
(#38479550)
My understanding is the compiler was insanely efficient and parts of it coded in assembly if I'm not mistaken.
I think that the question was rather why it took 25 seconds to the current compiler to compile an Hello world on a contemporary computer... Turbo Pascal would have definitely done that in a second or less on an 8086 CPU...
It was completely written in assembly
hand written and also optimized for throughput right ? maybe pascal syntax was also parsing friendly.. i don't recall
one thing for sure is that it felt near instant if not real time building small projects, to the point that 14yo me was completely unaware of meaning of Compile until years later.
What bear8642 says. I worked with Anders and interviewed the poor man about it!
>maybe pascal syntax was also parsing friendly..
Yep, designed to be single pass, recursive descent friendly
And despite being single pass, you could call functions and procedures before you defined them (later in the code), by using the forward declaration feature of Pascal.
Because of this feature, the language could also support mutually recursive functions, which some other languages might not have been able to (not sure).