Number::pairs()
Split a numeric range into evenly sized chunks as start/end pairs — great for batch processing and pagination math.
Entries tagged with "Performance".
Split a numeric range into evenly sized chunks as start/end pairs — great for batch processing and pagination math.
Memoize the result of an expensive expression so it only executes once per request, no matter how many times it is called.
Get notified when your cumulative database query time exceeds a threshold during a single request.
Time one or more closures and dump the results — the quickest way to compare performance of different approaches.
Keep a DOM element alive across Livewire page navigations — prevent re-rendering of video players, maps, or complex widgets.
Serve stale cache immediately while refreshing in the background — the stale-while-revalidate pattern built into Laravel.
Load aggregated values from related models as attributes — count, sum, min, max, avg — in a single query without loading the relation.