6 Quick & Easy Ways to Speed Up Your Laravel Website

  • This topic has 8 replies, 1 voice, and was last updated 2 months ago by milicjant.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2477
    ash_allen_
    Participant

    Hi guys!

    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)

    #2478
    htcram
    Guest

    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).

    #2479
    SimpleHacker
    Guest

    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 🙂

    #2480
    SirLoopy007
    Guest

    Awesome article.

    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.

    #2481
    Sparky549
    Guest

    Thanks for the tips!

    #2482
    aallport
    Guest

    ProTip: Save yourself 3 comands with `php artisan optimize`

    #2483
    Wensosolutions
    Guest

    Great Article Thanks for sharing Helpful Tips.

    #2484
    abrindas
    Guest

    Really good read. Thanks a lot for the article. Saved it for later use 😁

    #2485
    milicjant
    Guest

    > 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.