4 ms·
25 seconds to compile it? How come ?
by rezaprima 3y ago
25 seconds to compile it? How come ?
- giancarlostoro 3y agoMy understanding is the compiler was insanely efficient and parts of it coded in assembly if I'm not mistaken.
- ale42 3y agoI 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...
- tomcam 3y agoIt was completely written in assembly
- agumonkey 3y agohand 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.
- bear8642 3y ago>maybe pascal syntax was also parsing friendly.. Yep, designed to be single pass, recursive descent friendly
- vram22 3y agoAnd 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).
- tomcam 3y agoWhat bear8642 says. I worked with Anders and interviewed the poor man about it!
- qznc 3y agoNiklaus 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.
- kant2002 3y agoThat’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?
- cxr 3y agoYou'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.
- stg22 3y agoAlso, 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.
- timbit42 3y agoTechnically, 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.