4 ms·
I don't know about c++, but turbo pascal compiled so fast that it felt like an interpreter back in the day.
by quantumhobbit 10y ago
I don't know about c++, but turbo pascal compiled so fast that it felt like an interpreter back in the day.
- boznz 10y agoUsed both. TP was a lot faster but TC was no slouch. A Few years ago I managed to copy an old DOS diskette onto DOS VM and compiled and run a space invaders game I wrote. TC said it compiled but just kept returning me to the IDE when it executed! I eventually tweeked the VM speed down by about 100 at which point I saw the very fast invaders move to the bottom in about 2 seconds and kill my defender!
- 0xcde4c3db 10y ago> TP was a lot faster Not surprising. As far as I know, Pascal doesn't have anything remotely as hostile to efficient compilation as the C preprocessor (oh look, changing that one constant in a header file rendered your entire project out-of-date because the compiler can't prove that it doesn't make arbitrary memory layout and AST changes in every file that indirectly #includes it).
- badsectoracula 10y agoFWIW this is the same with Turbo Pascal's (and modern incarnations of it, like Delphi and Free Pascal). If you modify a constant in a unit, the compiler will recompile all other units that use that unit. The only way to avoid that is to keep everything in memory and do background updates to the AST. At which point you might as well do background compilations anyway.
- kqr 10y agoPascal, Delphi and Ada are a lot better than C and C++ in that regard, though, by virtue of actually having some sort of sensible module system.
- pjmlp 10y agoNot really, C++ build times are usually measured in hours for anything worthwhile using, e.g. Cocos2d-x as a possible example. You wouldn't get such compilation windows with Pascal derived languages using their module systems. The proof being that with VC++2017 using the incremental linker and C++ experimental modules, one also gets more human friendly compilation times. https://blogs.msdn.microsoft.com/vcblog/2016/10/05/faster-c-build-cycle-in-vs-15-with-debugfastlink/ https://blogs.msdn.microsoft.com/vcblog/2016/10/05/faster-c-... The Microsoft blog is only about the incremental linker, modules would speed it up even more.
- badsectoracula 10y agoI was referring to the given example, i actually use Free Pascal and Lazarus for my own tools and a big reason is how fast both the IDE (Lazarus) and the compiler (Free Pascal) are compared to anything C++ (well, anything except Borland C++ 5 i mentioned above and C++ Builder, but that isn't exactly fair considering the age of those programs :-P). But even in Turbo/Borland/Free Pascal modifying a unit means that you have to recompile the other units that need that unit.
- pjmlp 10y agoAh, ok. Actually I find those cascading of build dependencies quite productive. Sometimes I wonder if Pascal variants had gotten more love from gamedevs (TP was my Unity), if they would be always coming up with tricks to speed up their build times or force reloading of C++ code.
- badsectoracula 10y agoI think Pascal didn't got much love from gamedevs for more or less the same reason it didn't got much love from everyone else - there was only a single company with a popular Pascal compiler (Borland) and that self-imploded by trying to chase after enterprise markets while ignoring the masses of developers that made them popular in the first place. For the entirety of the 90s, people who wanted to write Pascal on a mainstream platform (ie. DOS and Windows) had very limited options. Official SDKs and OS APIs written in C didn't help either too, although that was a minor issue. But still created friction. Of course with Free Pascal that isn't the case anymore, FPC is the compiler with the second number of supported platforms (after GCC) and architectures, but the stigma and public perception of the language still prevails (for example many things that people laud D and Rust for are things that Free Pascal did for years).
- sehugg 10y agoAlso TP would usually link in-memory without creating .obj files (and it had real modules/units which made dependency analysis simple).
- badsectoracula 10y agoYeah, this was another reason why it was so fast - disk i/o was very slow (especially if -like me- you had no hard disk).
- vidarh 10y agoAbsolutely. Basically any Wirth-based language is designed so it is possible to compile each unit in a single forward pass. With those languages he did that has proper module support, and with most non-Wirth extensions to languages like Pascal, they tend to use very well constrained formats to cleanly delineate the type information and function signatures that is exported to retain that. Wirth-style compilers also often don't even build an AST. Wirths own compilers called functions in the code generator module directly from the parser. Which again was something he could easily do because the languages were designed for single pass compilation.
- cyberferret 10y agoHaha - I remember creating many games in Turbo Pascal etc. which used internal loops rather than the PC clock to time things like movement and speed. Experienced the same thing when PC's came out with the 'Turbo' button. I recall having to turn off Turbo many times to make games semi playable again on new PCs.
- torgoguys 10y agoPretty close. Back in high school, I was the 'Pascal guy' and one of my friends was the 'C guy.' One day, the friend, after looking through the large list of compiler and linker optimizations available in Borland C++ (and confirming they weren't in my Turbo Pascal) said we should have a Hello World file size competition--see who could get the smallest filesize with our respective languages (compilers really). He spent half a class period digging through the options, reading what would be best, then typed his Hello World program, and announced he was ready. Literally while his code was compiling (these were 386 machines IIRC which took some seconds back in the day), I typed the one-liner and built my code with Turbo Pascal...before his compilation was done. I had no idea if my executable would be bigger or smaller than his, but I didn't want to put effort into the contest until I knew I was behind. As it turns out, it was about half the size of the C executable and he never asked for a round two. My friend was very frustrated that day. Fun day. EDIT: I did some research. They were actually at best 286 machines. The computer lab had those IBM PS/2 all-in-ones with MCGA graphics.