A month ago, I went on a performance quest trying to optimize a PHP script that took 5 days to run. Together with the help of many talented developers, I eventually got it to run in under 30 seconds. This optimization process with so much fun, and so many people pitched in with their ideas; so I eventually decided I wanted to do something more. That's why I built a performance challenge for the PHP community The goal…
5 days to 30 seconds? What kind of factor/order of magnitude is that damn What takes 5 days to run
100M-Row Challenge with PHP
71–80 of 104 posts
Re: 100M-Row Challenge with PHP
#72A month ago, I went on a performance quest trying to optimize a PHP script that took 5 days to run. Together with the help of many talented developers, I eventually got it to run in under 30 seconds. This optimization process with so much fun, and so many people pitched in with their ideas; so I eventually decided I wanted to do something more. That's why I built a performance challenge for the PHP community The goal…
A month ago, I went on a performance quest trying to optimize a PHP script that took 5 days to run. Together with the help of many talented developers, I eventually got it to run in under 30 seconds. When people say leetcode interviews are pointless I might share a link to this post. If that sort of optimization is possible there is a structures and algorithms problem in the background somewhere.
Re: 100M-Row Challenge with PHP
#73Earlier quoted context omitted.
Pitch this to whoever is in charge of performance at Wordpress. A Wordpress instance will happily take over 20 seconds to fully load if you disable cache.
Are you talking about a new, empty WordPress instance running the default theme? Because if so, that doesn't match my anecdotal experience. If you're talking about a WordPress instance with arbitrary plugins running an arbitrary theme, then sure — but that's an observation about those plugins and themes, not core. As someone who has to work with WordPress, I have all kinds of issues with it, but "20 seconds to load c…
Naked Wordpress is plenty fast, but as soon as you start adding sketchy plugins and Themes, things can spiral out of control.
Re: 100M-Row Challenge with PHP
#74This is why I jumped from PHP to Go, then why I jumped from Go to Rust. Go is the most battery-included language I've ever used. Instant compile times means I can run tests bound to ctrl/cmd+s every time I save the file. It's more performant (way less memory, similar CPU time) than C# or Java (and certainly all the scripting languages) and contains a massive stdlib for anything you could want to do. It's what scripti…
It's almost comical how often bring up Rust. "Here's a fun PHP challange!" "Let's talk about Rust..."
Re: 100M-Row Challenge with PHP
#75Earlier quoted context omitted.
A month ago, I went on a performance quest trying to optimize a PHP script that took 5 days to run. Together with the help of many talented developers, I eventually got it to run in under 30 seconds. When people say leetcode interviews are pointless I might share a link to this post. If that sort of optimization is possible there is a structures and algorithms problem in the background somewhere.
Do you think they achieved that performance optimisation with a networked service because they switched from insertion sort to quicksort?
Re: 100M-Row Challenge with PHP
#76Earlier quoted context omitted.
As someone who built full ecommerce websites on wordpress over 15 years ago, I can tell you exactly why it hasn't been replaced - the plugin/theme ecosystem. There are tens of thousands of plugins and themes to make a Wordpress website do whatever you want and look however you want, either for free or a very low fee. You have to replace that entire ecosystem for the same price to replace Wordpress. No matter how many…
Maybe it's just my poor imagination but how many plugins are truly unique to WP that you can't find on other CMSs? The only ones that come to mind would be those plugins that help connect to various B2B or B2C workflows, is that where the gold is mostly found?
In other words, every property can be modified through global event callbacks. Some events are called very early in the whole pipeline that let plugins just render whatever they want (e.g. render custom XML sitemaps).
Re: 100M-Row Challenge with PHP
#77https://dev.to/realflowcontrol/processing-one-billion-rows-i...
Re: 100M-Row Challenge with PHP
#78https://github.com/kjdev/php-ext-jq
And replicate this command:
jq -R ' [inputs | split(",") | {url: .[0], date: .[1] | split("T")[0]}] | group_by(.url) | map({ (.[0].url): ( map(.date) | group_by(.) | map({(.[0]): length}) | add ) }) | add ' And it will be faster than anything you can do in native php
Edit: I'm assuming none of the urls have a comma with this but it's more about offloading it through an extension, even if you custom built it
Re: 100M-Row Challenge with PHP
#79I don't have time to put together a submission but I'm willing to bet you can use this: https://github.com/kjdev/php-ext-jq And replicate this command: jq -R ' [inputs | split(",") | {url: .[0], date: .[1] | split("T")[0]}] | group_by(.url) | map({ (.[0].url): ( map(.date) | group_by(.) | map({(.[0]): length}) | add ) }) | add ' And it will be faster than anything you can do in native php Edit: I'm assuming none of t…
Re: 100M-Row Challenge with PHP
#80Earlier quoted context omitted.
Aren’t these optimizations less about PHP, and more about optimizing how your using the database.
PHP is kind of like C. It can be very fast if you do things right, and it gives you more than enough rope to tie yourself in knots. Making your application fast is less about tuning your runtime and more about carefully selecting what you do at runtime. Runtime choice does still matter, an environment where you can reasonably separate sending database queries and receiving the result (async communication) or otherwis…