Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone know whether Turbo Pascal DOS/Windows compiler produced slower code than C compilers at the time? For a long time I was sticking with Pascal and resisted switching to C, even when everyone around me was doing so. One thing I do seem to remember from that time was that the things people were coding up in C seemed to work faster (not sure if it was Borland's Turbo C or something else). It was one of the arguments I remember for leaving Pascal.

Am I misremembering and it was just an urban legend/marketing from C compilers? Thinking back it doesn't seem logical that C would offer any significant performance benefits - both Pascal and C were compiled down to machine code and had approximately the same levels of abstraction.



While it is for Windows and not DOS, some time ago i wrote a small raytracing benchmark for C and Pascal (coded pretty much the same between the two languages) and the Borland compilers for C++ and Delphi (Object Pascal) had pretty much the same results: http://runtimeterror.com/tools/raybench/

What was probably the case is that there were more C compilers so some of them produced better code than Borland's.


Urban legend, as Borland fanboy, using their Pascal and C++ products, the generated binaries were pretty much the same, even if you might had to play with compiler pragmas, like disabling bounds checking for example.

In MS-DOS days, if you actually cared about performance, a macro Assembler was the only way to achieve it.


Borland Pascal had built in assembly which was very easy to use and integrated with the rest of the language. This let me have DOS program that had it's own high performance graphics for GUI (I basically stole Motif visual design with some adaptations) and proprietary preemptive multithreading. C programs venturing into same realm were not really any faster and had to use assembly anyways for performance critical parts.


Yes, that is how I used it as well.

To share a similar anecdote I was so proud of myself having created my own mouse support unit, that I then used to plug into a couple of BGI based applications.


Indeed it did, and it was magic. Just an asm: declaration and off you went, kitchen sink and access to variables included. I wrote some fairly nifty graphics stuff that way in the early Delphies, mid to late nineties. Great fun, still miss it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: