- This topic has 8 replies, 1 voice, and was last updated 2 months ago by milicjant.
- November 16, 2020 at 8:07 pm #2477ash_allen_Participant
Apologies if I shouldn’t be posting this here because it’s specific to Laravel.
I’ve started writing a little bit for my blog lately and I’ve tried writing something with a little bit of code in it. It covers a few areas that I’m quite often asked about by other developers or people who contact me and need some help speeding up their sites.
Maybe these tips won’t be much use for some of you, but if they help even 1 person out, then it was worth writing it.
I’d love any feedback on this so that I can try and improve for next time!
[https://ashallendesign.co.uk/blog/6-quick-and-easy-ways-to-speed-up-your-laravel-website](https://ashallendesign.co.uk/blog/6-quick-and-easy-ways-to-speed-up-your-laravel-website)November 16, 2020 at 8:07 pm #2478htcramGuest
In terms of the best bang for the buck, your list appears to be in reverse order. Other items to include might web server caching (static files). Using webpack to compile assets. Using redis. Edit: Using HTTP2 vs HTTP1….deferring load time to Ajax calls (Vue.js or Livewire components).November 16, 2020 at 8:07 pm #2479SimpleHackerGuest
Thank you! Point 6 helped me out. As a beginner I never really understood when or why to use queues, but that makes more sense now 🙂November 16, 2020 at 8:07 pm #2480SirLoopy007Guest
Near the end of Section 2, I believe there was a typo:
“this will fetch all of the comments and then make another query to fetch the *comments* at once. ”
I believe the 2nd use of comments was supposed to be authors.November 16, 2020 at 8:07 pm #2481Sparky549Guest
Thanks for the tips!November 16, 2020 at 8:07 pm #2482aallportGuest
ProTip: Save yourself 3 comands with `php artisan optimize`November 16, 2020 at 8:07 pm #2483WensosolutionsGuest
Great Article Thanks for sharing Helpful Tips.November 16, 2020 at 8:07 pm #2484abrindasGuest
Really good read. Thanks a lot for the article. Saved it for later use 😁November 16, 2020 at 8:07 pm #2485milicjantGuest
> Only fetch the fields you need in your database queries
with ActiveRecord pattern most of the time it’s not going to happen unfortunately
a) you will use half assed models = bugs
b) not all developers will follow it and **you have to decide when you do `select *` or single fields** which is very very confusing so…
c) … you go full active record or not active record at all. This is very serious issue – for example I don’t care if we use 2, 4, 8 space tabs, camel case, snake case, kebab case, no matter what programming language, no matter recommendations, mixing two styles is just very bad
d) invisible merge conflicts. Person A removes field from query, person B uses that field in model method. If there is not unit te
`User::query()->leftJoin(…extra data..)` is a code that makes people confused but it’s ok because you _add_ extra columns. But if you make query that returns less columns it can make big mess
I’m not complaining, just saying how it i, AR is not perfect pattern. And there is simple way to handle such situations – repositories + entities. But laravel by default uses AR pattern
- You must be logged in to reply to this topic.