New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Performance optimization - How to compile PHP with "PGO" ?
lowprofile
Member
in General
Did anyone tried to compile PHP with Profile Guided Optimization (PGO) with DirectAdmin?
Would like to hear if anyone had succes? How to do it?
I tried centminmod where you can activate PGO, and damn there are atleast 20-25% performance boost in my tests!
All clients can't go with centminmod due to the lack of GUI. Would like to hear if same option is possible with DirectAdmin? How to?
Comments
Oh how cute. the word Performance next to PHP.
How adorable.
Want a cookie for being all cool on the "we hate PHP but can't come up with a good reason" bandwagon?
They don't have time for that. They busy writing websites in ASM or C.
No point in explaining morons why the zend project concurrency model of spawning a thread per request makes it the worst performing language for the past ~6 years worth of benchamarks @ TechEmpower.
But I do like how girls like you feel the need to post long messages and press a lot of keystrokes.
worst compared to what other scripting language? NodeJS? Ruby? Python?
PHP in itself is actually faster than all the three and with an actual Type system.
People use the thread per request model for convenience and not speed.
if you need performance, PHP does async too, https://www.swoole.co.uk/ https://amphp.org/ https://reactphp.org/
some benchmarks for what async PHP can do,
https://medium.com/@rioastamal/benchmark-php-swoole-vs-nodejs-vs-go-539a5493b067
Golang is the king. We had many issues with Python not having type safety and being slow/memory hungry in some tasks. Rewriting almost the entire backend to Go was painful but totally worth it in the end.
Postgres would like a word with you. It's a single process per connection and requires some intermediary connection pooling to work in a high performance environment. Wonder why it's never under the same crosshairs as PHP...
Nodejs would like a word with you.
Unlike PHP or Node, Golang was created with 3 core performance concepts.
A userspace scheduler, Proc.go, which puts each connection (goroutines) that calls accept4() and epollwait() into G queues inside a single M thread, that needs a P (idle cpu) for the scheduler to unpark and run.
Nodejs tries to do the same with the Event Queue, however, it's just a callback, not a preemptive scheduler like Go.
Second thing Go has is a netpoller, which waits in a loop for epoll events.
n := epollwait(epfd, &events[0], int32(len(events)), waitms
return gList{}
@ TEXT runtime.epollwait(SB) /usr/local/go/src/runtime/sys_linux_amd64.s
If an event returns, the netpoller will check for parked G queues, and mark them as runnable.
Go also has an arena heap memory model, which allows goroutines to exchange data using only 2 instructions.
If you compare the scalability of Go with PHP, you will notice PHP guys don't really bother in firing hundreds of expensive syscalls, have no control over blocking syscalls, have interpreted code that burns runtime cycles just for parsing syntax into IR, they lack pointers, thread synchronization and memory safety primitives, and a horrible model of cloning threads per connection.
Take guys like Ryan Dahl, creator of Node.js, publicly saying Node is a piece of crap compared with Go.
Just look at his quotes about Node/PHP.
Those golang fanboys... 2+2 - use golang. Need a website? Use golang. Need an AI? Sure, slam golang on it.
Every language has it's place. This topic about PHP and PGO. So back on topic - PGO is not worth the time in compare to performance increase. It is very negligible. Just APC and you are done.
Eh you can use generators and asynchronous signal handling these days in PHP. It's not as fast as some alternatives, but does the job when programmed accordingly.
OP was asking about PHP, not regurgitating a Go whitepaper.
APC was superseded by OPCache unless you want an embeddable userland cache, then apcu.
That is actually hilarious.
External calls to C code because you can't do it in PHP.
Bytecode cache because you can't compile into native code.
OS threads with mutex syscalls, because yeah why not, you have no idea what user-threads are in terms of performance. No context switching, no expensive IPC, only atomic CAS, why bother.
There is a good reason why Techempower calls programmers from all over the world to submit their best code in their language, and not a single guy in 10 years has ever made it into top ~80 with PHP, where Go ranks top 10 consistently.
Look at the garbage of Swoole. Rank #143. That is the best PHP can offer.
PHP is a joke among software engineers, everybody @ TE laughs at how crappy it performs.
Y'know, that's the nicest thing anyone's said about me in a long time. I'm going to take it.
Heading over to https://www.lowendtalk.com/profile/comments/Jona4s and searching for the word "PHP" is actually hilarious.
I bowed out when his link back wasn't its composite score - in which PHP does decent - but the worst of the worst, a plaintext cloud benchmark.
This comment especially had me. Poor nikic and his shit CS/Phys degree from Technical University of Berlin. Reminds me of that equally shitty programmer... what's his name, Venma Wieste... no no... must be Wietse Venema. Guy's such an oddball it's hard to place it together, but I believe from a cursory Google and IBM's corporate pages... he's... right, the architect of Postfix. Much of this invective is simply backdated.
PHP was terrible in 4 and 5, that I'll agree (as were most languages of the era). 7 and 8 are moving the language forward. Don't conflate the core talent behind PHP now with what it had in 1999. They're moving things along at a frenetic pace. Go's great benefit (Rust too) is that it started later and could learn from the mistakes of its progenitors. At some point when things slow down I want to rewrite my PAM handlers in Rust because C gives me the heebie jeebies.
Edit: restating the pace of current development sponsored by JetBrains.
It's nice to see a mongoloid provider who can't tell the difference between application code used for the overall score, and the language runtime that stresses plaintext requests.
Must be why you enjoy using a scripting language.
Is that the only reply you could think of? What a way to admit that you are wrong.
Of course I'm wrong. I'm replying to a bunch of morons.
Doesn't get worse than that.
Ahhh, personally attacking users here like calling them morons should prove your point. Maybe try more civilized responses and maybe someone here would actually consider your opinions.
all part of the low end experience; attack, belittle and insult - low end mentality.
If there's one thing you should take from this thread: you're pretty shit, stay away from any parties until you get over whatever troubling shit you're going through.
Doesn't matter if they are morons or not.
PHP is a piece of garbage as proven by Techempower.
What's the discussion here?
Now replace the word "mongoloid" with "black" and see how racist that sounds. There was no need for that word.
compared to a compiled language? May be. but PHP is inherently better when it comes to economics, Faster dev cycles, no process restarts required and better state isolation.
Given a choice between PHP and Go for web development, I would choose PHP any day because there is a lot more to a business than than saving a few milliseconds. It took me a while to understand this, but in the world out there, Adding new machines is cheap but developers are very expensive.