How to run over 30k tests in under 5 minutes
Paratest is an extension on top of PhpUnit that adds support for parallel testing. For our unit tests, we could just add Paratest and it works without any configuration!
Read more [blog.mollie.com]
Posts tagged with optimization
Paratest is an extension on top of PhpUnit that adds support for parallel testing. For our unit tests, we could just add Paratest and it works without any configuration!
Read more [blog.mollie.com]
When reviewing the contents of the database of Flare, we encountered a table with 1 billion records. Technically that isn't a problem. Flare runs on Vapor and uses an Aurora database, so it can handle that scale. But of course, there's a cost for storing that many records.
We dove in and concluded that we could safely delete about 900 million records. They all were created before a specific date.
Read more [flareapp.io]
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
Jonathan Reinink published another excellent blogpost on db performance.
Read more [reinink.ca]
Nikita Popov discusses some low level performance optimizations in PHP.
My buddy Mattias recently improved the performance of the Oh Dear uptime checker servers by disabling the HTTP sessions.
If you run a Laravel application purely as a headless API, you can benefit from disabling the HTTP sessions. We use this setup for our Oh Dear monitoring service, where the remote servers that check for uptime are all headless Laravel setups.
Read more [ma.ttias.be]
My colleague Brent solved a performance by creating a custom relation
One last solution that came to mind was to load all people, all contracts, and map them together manually. In the end that's exactly what I ended up doing, though I did it in the cleanest possible way: using custom relations.
Read more [stitcher.io]
? Did you know you can add query-constraints when eager loading relationships in Laravel?
— Stefan Zweifel (@_stefanzweifel) November 12, 2019
Perfect opportunity to improve query performance when your relationships return thousands of models.
↳ Full example: https://t.co/RsezzpkWoC pic.twitter.com/nwjC7U8Oqa
Read more [twitter.com]
About a year ago, we released laravel-event-projector. It focused on adding projectors, an important concept in event sourcing, to Laravel.
After the release of the package, we continually kept improving it. We added aggregates, a way to test those, a brand new section in the our documentation that explains event sourcing from scratch, and DX improvements all across the board.
We now feel confident that the package is a good starting point for getting started with event sourcing in Laravel. That's why we're renaming the package to laravel-event-sourcing.
? Perf tip: if your web app ships large JSON-like configuration as JavaScript object literals, consider using JSON.parse instead. It’s much faster, especially for cold loads! https://t.co/C0oQ4BLnfz pic.twitter.com/p0WICUm7zx
— Mathias Bynens (@mathias) June 25, 2019
Read more [twitter.com]
Matt Allan explains why using an offset is slow when used on large datasets.
It turns out it’s easy to page through results without using offset. All we have to do is keep track of the last ID we saw, then filter the results so we only fetch rows we haven’t seen.
Read more [mattallan.me]
In a new post at the madewithlove blog, Geoffrey Dhuyvetters explains how you can organize your code so a bundler can make it as small as possible.
As an author of (open source) packages, I think you have the responsibility to protect the bundle size of your package consumer. When you publish a package that exports a whole range of modules (for example lodash, ramda, date-fns…) you want to make sure the package is exported in such a way that the consumer of your package (mostly bundlers) can optimize size.
Read more [madewithlove.be]
In an older but still post, Steve Hanov explains a nice algorithm to test out new features on your audience. I don't now if this approach will yield better results, but it sure is an interesting idea.
In recent years, hundreds of the brightest minds of modern civilization have been hard at work not curing cancer. Instead, they have been refining techniques for getting you and me to click on banner ads. It has been working. Both Google and Microsoft are focusing on using more information about visitors to predict what to show them. Strangely, anything better than A/B testing is absent from mainstream tools, including Google Analytics, and Google Website optimizer. I hope to change that by raising awareness about better techniques.
Read more [stevehanov.ca]
For the first time in 4 years we completely redesigned our company website. We launched it today. The site is a simple Laravel app with some technical niceties. True to form we also open sourced the app, you can find the code in this repo on GitHub. In this blogpost I'd like you to give you a tour…
Barry van Veen recently fixed an interesting performance issue at our permissions package.
Recently I was investigating the performance of an application we have built at SWIS. To my surprise, one of the most excellent costly methods was part of the spatie/laravel-permission package. After reading some more it was clearly a performance issue that could be improved upon. Since the solution was already clearly outlined it was quite easy to code it and submit a pull request.
https://barryvanveen.nl/blog/46-improving-the-performance-of-spatie-laravel-permission
Collin O' Dell, member of the PHP League, shares how he was able to significantly improve the performance his json5 package using Blackfire profiling.
Back in November I released colinodell/json5 - a JSON5 parser for PHP. It's essentially a drop-in replacement for PHP's json_decode() function, but it allows things like comments, trailing commas, and more.
...
I always knew that a PHP-based implementation would be slower than PHP's native C implementation, but execution time measured in minutes was completely unacceptable!
So I fired up Blackfire (which I've previously used to optimize league/commonmark) and got to work.
https://www.colinodell.com/blog/201801/optimizing-colinodelljson5-blackfire
Probably you know that that keeping the disk & transfer size of a JavaScript file low is pretty important. But have you considered the time needed to parse and compile the code? In this great post on Medium Addy Osmani, an engineer at Google, explains the complete cost of having JavaScript on your page.
As we build sites more heavily reliant on JavaScript, we sometimes pay for what we send down in ways that we can’t always easily see. In this post, I’ll cover why a little discipline can help if you’d like your site to load & be interactive quickly on mobile devices. tl;dr: less code = less parse/compile + less transfer + less to decompress
https://medium.com/dev-channel/the-cost-of-javascript-84009f51e99e
yes is a Unix command that will spit out and infinite stream of y's. In a post on his blog Matthias Endler, an engineer at trivago, shares that there's more than meets the eye to make this happen in a performant way.
The trivial program yes turns out not to be so trivial after all. It uses output buffering and memory alignment to improve performance. Re-implementing Unix tools is fun and makes me appreciate the nifty tricks, which make our computers fast.
Addy Osmani, a Google Chrome engineer, recently published a e-book on image optimization. You can read it in it's entirety here: https://images.guide/
Images take up massive amounts of internet bandwidth because they often have large file sizes. According to the HTTP Archive, 60% of the data transferred to fetch a web page is images composed of JPEGs, PNGs and GIFs. As of July 2017, images accounted for 1.7MB of the content loaded for the 3.0MB average site.Per Tammy Everts, adding images to a page or making existing images larger have been proven to increase conversion rates. It's unlikely that images will go away and so investing in an efficient compression strategy to minimize bloat becomes important.
If you need to optimize images in your PHP application take a look at our image optimization package. If you're a Laravel user you'll be happy to know that there's also a Laravel version of the optimizer. Our Laravel Medialibrary also comes with built-in support for optimizing images.
Our recently released image-optimizer package can shave off some kilobyes of PNGs, JPGs, SVGs and GIFs by running them through a chain of various image optimization tools. In this blog post I'll tell you all about it. First, here's a quick example on how you can use it: use…
Chris Fideo, of Servers For Hackers and Shipping Docker, published a new free video serious on optimizing performance for Laravel apps. He shows how to use the built in artisan commands such as config:cache and route:cache,how to optimize queries, build up good indexes and how to add an object cache in a clean way.
There are some super common reasons your Laravel app might be slow. This course shows you how to avoid speed issues with simple changes you can implement immediately.
https://serversforhackers.com/laravel-perf
Chris is also a working on a paid course on how to scale Laravel apps. If you want to stay in the loop for that one, subscribe to his newsletter.