News for hackers. Stuff that matters.
Re:Taking PHP Seriously by ransom1538 on Friday October 14, 2016 @10:38AM (#12708340)
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-...

Re:Taking PHP Seriously by pritambarhate on Friday October 14, 2016 @03:19PM (#12710434)
This benchmark shows things a little bit differently.

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.

Re:Taking PHP Seriously by Shanea93 on Saturday October 15, 2016 @03:46AM (#12713147)
It'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)

Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @02:58PM (#12737566)
> 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

Re:Taking PHP Seriously by spronkey on Monday October 17, 2016 @05:00AM (#12723544)
PHP'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.
Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @02:48PM (#12737469)
Perhaps 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-discus...

Re:Taking PHP Seriously by tigershark on Friday October 14, 2016 @06:07PM (#12711489)
I 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.
Re:Taking PHP Seriously by Shanea93 on Saturday October 15, 2016 @03:38AM (#12713128)
Most 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.

Re:Taking PHP Seriously by ufmace on Saturday October 15, 2016 @09:51AM (#12713911)
This 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.
Re:Taking PHP Seriously by sethrin on Saturday October 15, 2016 @09:07PM (#12716345)
Many/most PHP platforms these days do claim to be either MVC or Rails-based or both. CakePHP is not a bad example there. There are however a few other very large projects whose take on MVC is lacking to some degree. Drupal is not bad, Joomla is worse, and of WordPress the less said the better. Note also that those projects are listed in order of increasing popularity.

Modern PHP frameworks and tools are good, perhaps even excellent. Composer and the PSR-# efforts have spurred a renaissance in code quality and interoperability, and PHP7 brings some truly impressive speed improvements. For those of us who aren't stuck supporting legacy code, that is. One of these days I will be working with a language whose syntax I enjoy, but until then the language that puts the "sin" in "syntax" will (for better or worse) keep getting the job done.

Re:Taking PHP Seriously by vancouverwill on Monday October 17, 2016 @03:37PM (#12728716)
Performance is directly related to profit on consumer apps. See http://glinden.blogspot.co.uk/2006/11/marissa-mayer-at-web-2...

plus like you say PHP might be faster to get started with but becomes much slower on larger projects due to inconsistent error handling and language design.

Re:Taking PHP Seriously by jbergens on Friday October 14, 2016 @11:12AM (#12708589)
Funny 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.
Re:Taking PHP Seriously by juliangoldsmith on Friday October 14, 2016 @11:50AM (#12708891)
It's worth noting that it's compiled JavaScript vs. interpreted PHP. With something like HHVM the PHP version would likely be a lot faster.
Re:Taking PHP Seriously by secoif on Saturday October 15, 2016 @01:48PM (#12714936)
Compiled JavaScript?
Re:Taking PHP Seriously by niutech on Tuesday October 18, 2016 @01:35PM (#12736829)
I think he meant JIT compilation.
Re:Taking PHP Seriously by icedchai on Friday October 14, 2016 @07:42PM (#12711859)
Looks 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.
Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @03:08PM (#12737667)
> 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!" ;-)

Re:Taking PHP Seriously by magic_quotes on Friday October 14, 2016 @10:04PM (#12712407)
> 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.