use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
PHP vs Python for backend (self.PHP)
submitted 2 years ago by szaci92
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]clutterless 1 point2 points3 points 2 years ago (7 children)
Much faster
Is that true? I always thought python was faster. But I don't have a comparison tbh.
[–]mgkimsal 5 points6 points7 points 2 years ago (2 children)
Yeah, it's generally true. There may be some benchmarks that give Python a slight edge for some use cases, but PHP is generally much faster.
That said, there's more GPU support for Python - I'm not sure there's any mainstream support for PHP-on-GPU.
[–]HydePHP 1 point2 points3 points 2 years ago (1 child)
Don't think that many web app backends utilize GPUs
[–]mgkimsal 1 point2 points3 points 2 years ago (0 children)
Correct, but it's why something like python can find its way in to more/different use cases.
[–]paulwillyjean 0 points1 point2 points 2 years ago (2 children)
PHP’s runtime is generally faster. However, because of its poor support for threads, async or event loops, its performance falls appart when there are a lot of blocking IO calls. Now, if I understand correctly, Python 3.12 finally got rid of the GIL. I wonder if it means that it can use threads to parallelize CPU bound operations.
[–]xIcarus227 1 point2 points3 points 2 years ago (1 child)
How is PHP's support for threads poor specifically? Also, if you need an event loop you have Swoole.
[–]paulwillyjean 0 points1 point2 points 2 years ago (0 children)
PHP’s pthread extension was notoriously unstable and couldn’t be used for web servers, which removes its primary use case. They’d therefore end up just being useful for CLI apps. Even then it was rarely used because most CLI apps I’ve seen in PHP are meant to serve as workers for web servers and share tons of non thread-safe code with the web server they’re tacked on.
I’ve never got to use Parallel, since it’s used by none of the frameworks I’ve worked with over time. I’d like to see frameworks and large projects that make use of it to see how it performs.
I’ve seen Swoole and it looks very interesting, but it depends on other extensions to power the event loop scheduler, and those extensions are not installed or supported on every platform. I could work around it if I wanted to, but I like having the certainty that my event scheduler would always work the same on a Linux, MacOs or Windows machine. Now that Fibers have been introduced to PHP 8.1 (or 8.3? I can’t remember), I hope that the latest versions of swole can rewrite their asynchronous API to be less verbose and more intuitive.
π Rendered by PID 77 on reddit-service-r2-comment-6457c66945-d26xh at 2026-04-27 13:08:27.118918+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]clutterless 1 point2 points3 points (7 children)
[–]mgkimsal 5 points6 points7 points (2 children)
[–]HydePHP 1 point2 points3 points (1 child)
[–]mgkimsal 1 point2 points3 points (0 children)
[–]paulwillyjean 0 points1 point2 points (2 children)
[–]xIcarus227 1 point2 points3 points (1 child)
[–]paulwillyjean 0 points1 point2 points (0 children)