5 ms·
Performance? You need to update your act. PHP7 is 3x faster than python and now faster than Java 8 . The only people that can call php slow are masochistic c++
by ransom1538 10y ago
Performance? You need to update your act. PHP7 is 3x faster than python and now faster than Java 8 . The only people that can call php slow are masochistic c++ web hacks.
https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-vs-php-performance-benchmark-2016/ https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-vs-...
- jbergens 10y agoFunny that people complain about js performance. In this benchmark it was 3 times as fast as php7 and about 7 times as fast as java 8. Have not checked the details of the benchmark yet.
- juliangoldsmith 10y agoIt's worth noting that it's compiled JavaScript vs. interpreted PHP. With something like HHVM the PHP version would likely be a lot faster.
- icedchai 10y agoLooks like you're reading that wrong? Java 8 is listed twice. Java 8, when using the non-standard library version of the program is second only to C++. This is pretty much as expected.
- igouy 10y ago> Have not checked the details of the benchmark yet. < "Will your toy benchmark program be faster if you write it in a different programming language? It depends how you write it!" ;-)
- pritambarhate 10y agoThis benchmark shows things a little bit differently. http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=php&lang2=java http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... But I think, what's important to note is that PHP 7 has improved in speed department by a great deal.
- Shanea93 10y agoIt's probably worth mentioning that the regex-dna test time is kind of incorrect and provides an inaccurate view of what's happening. Java-8 is using java.util.regex which is written in Java, PHP is passing the regex requests to it's own regex process which is actually a C package and performs a lot faster. What we're actually comparing here is: time(java.util.regex) > time(php compilation + c regex package)
- spronkey 10y agoPHP's execution performance is highly dependent on whether you are piggybacking the C implementations, or pure-PHP ones. That said, this is still a correct benchmark, if your use case involves a lot of regex.
- igouy 10y ago> Java-8 is using java.util.regex < No, the fastest Java program shown does not use java.util.regex The fastest Java program shown uses com.basistech.tclre > a C package and performs a lot faster < You're welcome to contribute a Java program that uses the PCRE library -- http://benchmarksgame.alioth.debian.org/play.html http://benchmarksgame.alioth.debian.org/play.html
- tigershark 10y agoI don't care about performance. Unless we are speaking about orders of magnitude and my use case has an absolute need for performance. If I only cared about performance I would write everything in assembly optimised for every specific architecture. But strangely I'm much, much, much more productive writing in c#, Java, groovy, f#, ruby and whatever language is appropriate for what I need to do at a certain time. For sure I won't start a new project using a language in which writing such abominations as accessing the database in the presentation layer is not even discouraged, but it is actually encouraged and taken as an example on HN in this thread. Enjoy your marvellous php. But please stop the bullshit that pushed a lot of people to use that franken-language rather than using a better approach.
- Shanea93 10y agoMost professional PHP developers I've anecdotally worked with use a Model-View-Controller pattern these days, where the SQL is abstracted away in the model under something like Doctrine2-DBAL, Propel2 or PDO. If I was hiring for a developer and they suggested putting raw SQL in the view layer, I would reject them. If I received a pull request from my team which did the same, I would reject it. You seem unnecessarily argumentative about this, almost like you're angry and I really don't understand why. There really isn't that much difference between languages like Ruby and PHP to warrant this and almost anything can be expressed in almost the same way, the only real differences are syntactic sugars and the "flexible" type system.
- ufmace 10y agoThis exactly. Never been a PHP developer, but I did get handed a PHP webapp to copy some functionality out of for a replacement C# webapp. I was a little surprised to find out that it was written in a rather Rails-like architecture using some PHP MVC library, I think it was CakePHP. Rails was a hit, and a great step forward in web development, so naturally every other language copied as much of it as possible, including PHP. There may be plenty of weird quirks about the language still, but at least the architecture is much improved.
- 10y ago
- magic_quotes 10y ago> now faster than Java 8 Don't trust everything you read on the internet, run the benchmark yourself and see if that result is actually reproducible. (Depends on the heap size.) There is also a "non-std lib" java test case, which doesn't generate as much garbage and, of course, performs much better.
- igouy 10y agoPerhaps the problems are with the way the Java program is written and run? Back in 2012: "5) The idea is to help you understand that you aren't comparing what you say you're comparing. If your intention is to compare time taken to grow a list, then shouldn't you start with lists that are the same size, and start with program heap that's the same size, and use the same max heap size? user+sys for your Java program = 20.56s But change ArrayList<Integer> s = new ArrayList<Integer>(); to ArrayList<Integer> s = new ArrayList<Integer>(8192); and run with java -Xms1G PrimeNumbersBenchmarkApp user+sys = 6.9s I don't think you're comparing what you say you're comparing." http://www.famzah.net/download/langs-performance/java-discussion-by-Isaac-Gouy/ http://www.famzah.net/download/langs-performance/java-discus...