from Hacker News

Pascal is faster than C++

by lonk on 2/11/19, 8:50 PM with 8 comments

  • by jcelerier on 2/11/19, 9:28 PM

    That's extremely convincing arguments:

    > C++ programs have the potential of running 5–10% faster than Pascal programs. However, in practice Pascal programs usually run faster. This is because human factor will inevitably involve in real world situations. Consider this experiment:

    > Pick a simple task and have 2 different individuals work on this task separately. Limit their times to 10 minutes. One will code in Pascal, the other in C++.

    > * Pascal programmer will implement the task in 1 minute. S/he will spend remaining 9 minutes to optimize the code.

    > * C++ programmer will implement the task in 10 minutes. No time left for optimization, hence the program will run poorly.

    I will be honest : if I only had this blog post as a source of information on Pascal and C++, I would almost certainly choose C++ because the lack of proper arguments certainly means that you are actually unable to put some figures forward and are just trying to bullshit your reader while deep down you know that your comparison does not hold.

  • by ncmncm on 2/12/19, 12:55 AM

    "You just keep telling yourself that..."

    I'll be over here. The greater expressiveness of C++ means that optimization effort can be, and routinely is, captured in libraries where it benefits every user. Because optimization effort is amortized over all users, more attention can be devoted to it -- and, again, routinely is.

    Powerful libraries that can eke out machine potentialities without compromise and deliver them to many users, to compose with other powerful libraries, make a language fast and quick to code in.

    C++ isn't the only language good for capturing optimization in libraries. Rust is good and getting better fast. I don't know about others. D, probably.

    The MLs and Haskell could be good in this way if they were not saddled with obligate GC.

  • by taylodl on 2/11/19, 9:33 PM

    The article presents no evidence that Pascal is faster than C++ other than in a given amount of time the Pascal programmer will have more time to optimize than the C++ programmer - and no citation is provided for that statement either.

    No mention is made of modern Pascal development environments and libraries needed to build modern applications. My experience is Pascal peaked in the 90s. What tools and libraries would I use today?

    These are the interesting questions I would expect an entry such as this to touch on.

  • by jwkane on 2/11/19, 11:14 PM

    15 years ago, the conventional wisdom (for whatever that is werth), was that C++ and Pascal produce similarly efficient compiled binaries. You could cherry pick examples that would show one or the other was "faster".

    Clearly C++ has has a whole lot more neurons grinding on how to better optimize it over the last 15 years. That should be good meat for an rich and enlightening article.

    Instead we get bunk. Code times for Pascal vs. C++ with experienced developers are similar. I've written quite a bit of both. If you want to play ridiculous code-time games you might as well argue that Python is faster than C++.

    I would be interested in a real head-to-head of modern pascal vs C++ including compile time. But that require a lot of real work where a fluffy thing like this only requires an opinion.

  • by drallison on 2/12/19, 2:47 PM

    This article is rife with questionable and incorrect statements and is missing any convincing data.