Live data from Hacker News

Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

phoronix.com

101–110 of 144 posts

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#101

Honest, sincere, question here: How is programming in PHP these days? I haven't used the language since 4.x-5.2 or so. I wrote it off completely when Hack and HHVM came out due to the nuances between it and PHP proper (not to say either is bad, it was just another barrier, and set of choices I didn't care to deal with). I typically write Ruby, Elixir, and some JVM based languages these days. Any new features or langu…

Very good, honestly.

PHP - at least if you're working on a modern 7.1 code base - isn't perfect, but it holds it's own. You do need at least one experienced person to stop you making serious mistakes (and with PHP, there are a lot of mistakes to make!), but in my experience that's true of every language.

Syntax is still a bit janky, the standard library has function names and parameter orders that seem to have been created by feeding the source code through a blender, and nested ternaries are a trap for the unwary due to their completely broken associativity rules.

On the other hand, the syntax isn't that bad, the gradual typing story is starting to get pretty solid, composer is really nice, IDE support is great, and the ecosystem is stable, mature, and deep. (And you shouldn't be using nested ternaries anyhow, come on, this isn't a code golf competition.)

As a general rule, I find the project I'm working on now to be slightly more pleasant to work on than the Python/Django app I worked on before, and significantly more pleasant than any node app I've worked on.

Five years ago, if you told me you were starting a new serious project using PHP for the server side I'd have thought you were probably making a mistake. Today, I wouldn't blink, again, not because it's perfect or the best, but because it's solid and mature and good enough.

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#102

I don't think PHP's main problem is speed. It's generally used for websites, and a few milliseconds aren't going to make a difference when pages are so bloated by JavaScript libraries to often be 5-10MB. PHP's problem IMHO is that I wouldn't be able to use it if it wasn't for autocomplete: inconsistent function names, inconsistent parameter order. The ecosystem is fine, there's Composer, PSR, Laravel. The problem is…

Really? So the main issue with php is a few functions have inconsistent parameter order? Ignore the massive speed improvements, composer package manager system or huge community. Good companies use php. I haven't met someone at facebook that can't code it. (please spare me the HHVM comment or how your intern friend does haskell in the basement). Have you read about python 2 vs 3? Have you actually seen real programmi…

>PS. Also, wtf does javascript librarys have to do with php.

The reference is likely pointing to the idea that individual url response times or throughput isn't the whole story. A php site that can do 1000 transactions per second may outrun a nodejs site that can do 3x that, if the individual pages drive fewer xhr requests per page. Or the client side js may be so bloated that the page doesn't render any faster if you make the back end faster. I've certainly seen SPAs that stall parsing/executing js for longer than the remote requests take.

Sometimes client side matters more than server side.

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#103
post #94

Earlier quoted context omitted.

Long time PHP dev here. Note: These are my personal observation and opinion. The usage you see are mostly from people already invested in PHP. However, I'm starting to see fewer new PHP devs. Some of the talented devs I know of have migrated to other "cool" languages. There are fewer PHP jobs than they use to be. I also observed less activity in PHP related subreddits. Its position as the #1 web server language has a…

Yes, if you search Indeed.com's API by job title there are currently more Node.js jobs (384) than PHP (268) in London (excluding WordPress, Drupal, Joomla & Magento).

I'm not sure that's entirely fair; a lot of those jobs you've excluded will be serious PHP coding jobs, not just "install and configure a plugin" sort of things.

There'd be a lot fewer node jobs if you managed to exclude all the ones that used express. :)

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#104

Earlier quoted context omitted.

"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode" Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go, Try it out in python (careful of the 2/3 quirks!): Python: https://stackoverflow.com/questions/275174/h…

Does stacking of PHP's ternary still result in hard-to-predict behavior?

Yes, documentation still suggest to avoid such practice, see the second note here: http://www.php.net/manual/en/language.operators.comparison.p...

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#105
post #69
post #56

Earlier quoted context omitted.

> Its position as the #1 web server language has already been taken over by nodejs How so? Because when I put a PHP script on a server with " " that is a one-liner and I'm sure it'll work for the next 20 years. With nodejs, I have to implement the whole webserver and then my web app is also a server, even if it's "only" 20 lines of code and I need other tools to make sure that this server never crashes or automatical…

With PHP you also need to implement a webserver (Apache), so you're one-liner is also actually not a one-liner at all. Also, pick the right tool for the right job. Who writes code these days that silently sit still for a decade? Hardly anyone. And even if you do, I don't think Python or Node will suddenly stop working (as you're implying).

>With PHP you also need to implement a webserver (Apache), so you're one-liner is also actually not a one-liner at all

With the "https everywhere" movement, the same is practically true for node. You will likely be configuring some outside proxy/webserver.

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#106

Earlier quoted context omitted.

Well, I specified "IMHO". That's the main issue that I have with PHP. I have no idea what they do at Facebook, and I don't have to work on the biggest community in the world that often. The problems I encounter in term of performance for websites/apps are along the lines of pages being super-slow because of the 100 JavaScript frameworks we like to use nowadays for the smallest of projects, my clients uploading 10MB i…

"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode" Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go, Try it out in python (careful of the 2/3 quirks!): Python: https://stackoverflow.com/questions/275174/h…

The java apache commons example uses methods named escapeHtml and unescapeHtml

Seems pretty sensible. How is that not support for the claim that php's method naming sucks by comparison?

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#107
post #88

Earlier quoted context omitted.

Really? So the main issue with php is a few functions have inconsistent parameter order? Ignore the massive speed improvements, composer package manager system or huge community. Good companies use php. I haven't met someone at facebook that can't code it. (please spare me the HHVM comment or how your intern friend does haskell in the basement). Have you read about python 2 vs 3? Have you actually seen real programmi…

Do you have a public example that illustrates how PHP/Hack code in Facebook looks like? My problem with PHP is that most of modern frameworks seem to take a lot from Java, and people have started to use type hinting whenever they can, so the code looks like (uglier) Java, but without advantages of performance (being made worse by having to setup everything on every request) or compile time type safety.

> being made worse by having to setup everything on every request

That does have advantages though, I have yet to see a popular PHP application break down due to memory leaks, compared to almost all Java code I've seen eventually ending up in memory bloat...

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#108

Earlier quoted context omitted.

Well, I specified "IMHO". That's the main issue that I have with PHP. I have no idea what they do at Facebook, and I don't have to work on the biggest community in the world that often. The problems I encounter in term of performance for websites/apps are along the lines of pages being super-slow because of the 100 JavaScript frameworks we like to use nowadays for the smallest of projects, my clients uploading 10MB i…

"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode" Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go, Try it out in python (careful of the 2/3 quirks!): Python: https://stackoverflow.com/questions/275174/h…

The guy literally said "PHP's problem IMHO is that I wouldn't be able to use it if it wasn't for autocomplete"

Why are you arguing against a strawman?

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#109
post #106

Earlier quoted context omitted.

"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode" Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go, Try it out in python (careful of the 2/3 quirks!): Python: https://stackoverflow.com/questions/275174/h…

The java apache commons example uses methods named escapeHtml and unescapeHtml Seems pretty sensible. How is that not support for the claim that php's method naming sucks by comparison?

If you don't want functions you use daily being built in and easy to use - just include a 3rd party one with composer. It will be namespaced properly.

Re: Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster

#110

Earlier quoted context omitted.

Well, I specified "IMHO". That's the main issue that I have with PHP. I have no idea what they do at Facebook, and I don't have to work on the biggest community in the world that often. The problems I encounter in term of performance for websites/apps are along the lines of pages being super-slow because of the 100 JavaScript frameworks we like to use nowadays for the smallest of projects, my clients uploading 10MB i…

"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode" Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go, Try it out in python (careful of the 2/3 quirks!): Python: https://stackoverflow.com/questions/275174/h…

I have no idea what you are talking about. How would hitting tab change html_entity_encode into htmlentities?
Post reply on HN