Slashdot Mirror


PHP 7.3 Performance Benchmarks Are Looking Good Days Ahead Of Its Release (phoronix.com)

PHP 7.3 RC6 was released earlier this week. Phoronix ran some benchmarks and compared the performance of v7.3 RC6 with releases going back to the v5.5 series. From the story: I ran some fresh benchmarks over the past day on PHP 5.5.38, PHP 5.6.38, PHP 7.0.32, PHP 7.1.24, PHP 7.2.12, and the PHP 7.3.0-RC6 test release. All of the PHP5/PHP7 builds were configured and built in the same manner. All tests happened from the same Dell PowerEdge R7425 dual EPYC server running Ubuntu 18.10 Linux.

Besides continuing to evolve the performance of PHP7, the PHP 7.3 release is also delivering on FFI (the Foreign Function Interface) to access functions / variables / data structures from the C language, a platform-independent manner for obtaining information on network interfaces, an is_countable() call, WebP support within GD's image create from string, updated SQLite support, improved PHP garbage collection performance, and many other enhancements. PHP 7.3 is just shy of 10% faster than PHP 7.2 in the popular PHPBench. PHP 7.3 is 31% faster than PHP 7.0 or nearly 3x the speed of PHP5.

18 of 91 comments (clear)

  1. PHP in a good language by gustavojralves · · Score: 5, Insightful

    Besides the critics, PHP is mature, well maintaned, has a good interaction with C and is easy to program.

    1. Re:PHP in a good language by Anonymous Coward · · Score: 3, Insightful

      That is one person's opinion from 7 years ago. PHP has advanced a bit since then.

      Way to be dishonest though.

    2. Re:PHP in a good language by Joce640k · · Score: 2

      Which parts of that are no longer applicable?

      --
      No sig today...
    3. Re:PHP in a good language by 110010001000 · · Score: 3, Insightful

      Virtually everything used to post your comment, from your local computer to the network to the server, was written in C++.

    4. Re:PHP in a good language by Joce640k · · Score: 2

      Yep, no clear answers yet.

      PHP 7 deprecated some more functions, broke a few things, added the spaceship operator, but apart from that it's basically the same. That page still applies.

      http://php.net/manual/en/migra...

      --
      No sig today...
    5. Re: PHP in a good language by batukhan · · Score: 2

      It seems to me most cotchas appear in legacy functions. New features are actually modern and well designed.

    6. Re: PHP in a good language by Joce640k · · Score: 2

      I don't even know what you're trying to say.

      Is the market share of something unspecified relevant to whether PHP 7 has fixed PHP or not?

      --
      No sig today...
    7. Re:PHP in a good language by gman003 · · Score: 2

      A lot of those are things that are technically still in the language, but there are far better ways to do them now.

      For instance, mysql_real_escape_string() was always a hack. The actual solution was proper placeholder syntax, which to be fair MySQL didn't support at the time even in its C API. We got that (in I think PHP5) with PDO, which is also database-agnostic.

      The lack of type hinting in function return types was added (I think PHP7?).

      Others are things that are clearly the result of the article author being a low-level programmer, and not understanding high-level language concepts.

      The lack of parallel programming is because it's designed as a web server scripting language. You extract parallelism by having multiple requests from multiple users, not from running each request multithreaded. And given just how complicated multithreading is, and how incredibly hard it is to get right, it's just not worth it. Making a good programming language is as much about what you leave out as add in. (and if you 100% need multithreading, there's a library mentioned *later in that article* to do so)

      The "redundant" syntax for blocks ("if (){ ... }" and "if: ... endif;") is actually quite useful. In big chunks of procedural code, curly braces are far more readable, but in code intermingled with HTML output, "endif" and cousins do a better job of telling you what block just closed.

      The author seems to completely misunderstand what weak typing *is*. He knows about type hints in function parameters, but complains that you can pass a string with a numeric value to a function calling for an int, and it will just be converted to an int instead of throwing an error. Why is that an error? In C-like languages it's an error because the variable has machine-level type that's fixed throughout its lifetime, but in weakly-typed languages, if you can convert it into an int, it *is* an int.

      In his complaints about E_STRICT, he mentions "using a variable as a function name". Which, if I understand what he's referring to right, is again a feature. You can use a variable to get a function name - "$foo()" will take the string value of $foo, and look for a function with that name. I've done pseudo-polymorphism this way.

    8. Re:PHP in a good language by K.+S.+Kyosuke · · Score: 2

      Virtually everything used to post your comment, from your local computer to the network to the server, was written in C++.

      The browser, perhaps. Perl, httpd, the Linux kernel, those are in C.

      --
      Ezekiel 23:20
    9. Re:PHP in a good language by tepples · · Score: 3, Interesting

      I tried to come up with a more balanced view on PHP, synthesizing Eevee's popular "fractal" essay, ManiacDan's "hardly" rebuttal, and Douglas Crockford's JavaScript: The Good Parts, to form coding standards and things that are still broken.

    10. Re:PHP in a good language by tepples · · Score: 2

      For instance, mysql_real_escape_string() was always a hack. The actual solution was proper placeholder syntax [...] We got that (in I think PHP5) with PDO, which is also database-agnostic.

      Even PDO doesn't support passing an array as a parameter for, say, the right side of SQL operator IN. Sometimes it can be easier to make a loop that does $db->quote() and then always use that loop for IN than to generate a string of question marks of the appropriate length and ensure that the parameters before the list, the parameters in the list, and the parameters after the list are always bound in the same order.

      The lack of parallel programming is because it's designed as a web server scripting language. You extract parallelism by having multiple requests from multiple users

      Which doesn't help if you happen to have only one user, or a small number of users one at a time, doing relatively heavyweight queries. You might end up doing cURL on localhost to spawn a bunch of subprocesses.

      in weakly-typed languages, if you can convert it into an int, it *is* an int.

      A numeric string in PHP behaves like an int in some contexts but not in others. This inconsistency leads people like her* to prefer languages that use strong dynamic typing, such as Python.

      "using a variable as a function name". Which, if I understand what he's referring to right, is again a feature. You can use a variable to get a function name - "$foo()" will take the string value of $foo, and look for a function with that name. I've done pseudo-polymorphism this way.

      As have I. But the messy part is that references to functions are stored as strings as opposed to being some other specialized type, as in C (function pointers), Python (callable objects), and C++ (both of the above). In addition, prior to PHP 7, it was impossible to catch a call to a missing function as an exception; programs had to use the look before you leap (LBYL) anti-pattern.

      * Eevee's name is Evelyn according to her Twitter account. I know her from a Discord server about Game Boy development.

    11. Re:PHP in a good language by wimg · · Score: 2

      A LOT of things mentioned on that page have changed. Which parts ? To name just 5 :
      - PHP is naturally tied to Apache - no it isn't. There's PHP-FPM, there's Nginx Unit, it even works on IIS.
      - php.ini applies to every PHP application run anywhere - there is a main php.ini but you can override this anywhere you want and in any webserver
      - Similarly, there is no easy way to “insulate” a PHP application and its dependencies from the rest of a system. Running two applications that require different versions of a library, or even PHP itself? Start by building a second copy of Apache - couldn't be more wrong. It's in fact very easy to run multiple PHP versions next to eachother.
      - PHP basically runs as CGI. Every time a page is hit, PHP recompiles the whole thing before executing it. Even dev servers for Python toy frameworks don’t act like this - PHP opcache has been part of core for many years
      - No coherent deployment mechanism - plenty of solutions exist, depending on your toolset

      Nobody says PHP is perfect, but neither are other languages. They all have quirks. But pointing to documents from 2012 is kinda ridiculous...

    12. Re:PHP in a good language by gman003 · · Score: 2

      Even PDO doesn't support passing an array as a parameter for, say, the right side of SQL operator IN. Sometimes it can be easier to make a loop that does $db->quote() and then always use that loop for IN than to generate a string of question marks of the appropriate length and ensure that the parameters before the list, the parameters in the list, and the parameters after the list are always bound in the same order.

      Yeah, that is mildly annoying, but that's a pretty niche feature missing. I've wanted it maybe a half-dozen times in my career. (And I think it's a limitation of the underlying C APIs as well?)

      Which doesn't help if you happen to have only one user, or a small number of users one at a time, doing relatively heavyweight queries. You might end up doing cURL on localhost to spawn a bunch of subprocesses.

      If you *need* to spawn subprocesses, there is a module for it. It's not something 99% of users ever need to do, and is usually a sign that you're either using the wrong language entirely, or are architecting things completely ass-backwards.

      Language design, as I said, is as much about choosing what features to leave out as it is what features to add. PHP has very, very limited multiprocessing support. But C has no eval() function, and anyone asking for it would rightly be asked what the hell they were thinking. Likewise, I think it's fair to say anyone looking for top-notch multiprocessing support in PHP is doing something at least a little fucky. I've done it myself, once or twice, but it was always something PHP was not meant to do.

      A numeric string in PHP behaves like an int in some contexts but not in others. This inconsistency leads people like her* to prefer languages that use strong dynamic typing, such as Python.

      Preference is fine, but she is declaring a language fundamentally flawed because it doesn't match her personal preference.

      Now, it is a valid complaint that PHP will often make counterintuitive or even lossy conversions, with barely a notice logged. Were I to design a PHP replacement language, I would certainly make it so that only lossless conversions can happen implicitly (eg. string "0.0" can convert to float 0.0 but not int 0). But that is still a matter of preference, and PHP's "let's try to make it work" philosophy is at least consistent here.

      As have I. But the messy part is that references to functions are stored as strings as opposed to being some other specialized type, as in C (function pointers), Python (callable objects), and C++ (both of the above). In addition, prior to PHP 7, it was impossible to catch a call to a missing function as an exception; programs had to use the look before you leap (LBYL) anti-pattern.

      On the other hand, using it as a string allows some rather useful tricks. Like that pseudo-polymorphism thing I mentioned - I was writing a report generator, and needed three functions implemented for every report type. I *could* have just written one function, and made a giant switch statement for the two-dozen report types, or I could have shoehorned them into classes and objects... but instead I just set up a naming convention, and did some string concatenation to get the right function names.

      * Eevee's name is Evelyn according to her Twitter account. I know her from a Discord server about Game Boy development.

      Noted, thanks.

  2. Re: Why the constant focus on "performance"? by batukhan · · Score: 4, Informative

    Working on horrendous legacy code, we did a whole system rewrite and saw our server costs cut in half. Our main expenses are staff wages and server costs. Performance is a real issue.

  3. Re: Why the constant focus on "performance"? by Hadlock · · Score: 2

    I'm sure Facebook, arguably the largest PHP user on the web, would disagree with not needing more performance. An extra 1-2% performance bump is equivalent to getting an extra year of use out of compute resources they already own and have received a tax benefit from depreciation. It's million of dollars of free money.

    --
    moox. for a new generation.
  4. Re:You have a point there. by colfer · · Score: 3, Informative

    The session-handling has been a strong point from the beginning, or so I've read. It's certainly easy to use. I'd rather write in Perl or another language, but for web stuff PHP has the win. Despite all the crazy functions, it's solid. Upgrading is easy, modules all fit. Still some fatal errors that should be warnings.

  5. Re: Why the constant focus on "performance"? by drinkypoo · · Score: 4, Interesting

    While this all makes sense, my problem with PHP ain't CPU burn, it's memory usage. What I need from my PHP CMS is for it to use less RAM, not for it to use less CPU. CPU is cheap, RAM ain't.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  6. Re: No one in his right mind uses PHP these days by Anonymous Coward · · Score: 2

    As a programmer you need to be able to speak the most popular language of the web which is PHP. But, that doesnâ(TM)t mean you only need to use PHP. Just have an understanding of atleast 3 to 4 major languages and decide which one to use based the task you are trying to accomplish. Personally, I donâ(TM)t use Python for basic website with a backend. With both Flask and Django around I donâ(TM)t think python is a good programming language to use when it comes to web development . And on the other side I donâ(TM)t use PHP for ML application because Python does that way better than any other languages .