DEV Community

Discussion on: Speed up Laravel in Docker by moving vendor directory

Collapse
tylerlwsmith profile image
Tyler Smith Author

No, you didn't miss anything. It's janky. I don't love the solution I came up with in this article, but I considered my app unusably slow during development before I did this. You could always forgo the container on the host machine if you don't use your editor's IntelliSense. It eliminates the syncing issue at least πŸ€·β€β™‚οΈ

Collapse
michabbb_76 profile image
Michael Bladowski

okay, i understand. itΒ΄s different, but in the past i had similar problems with "code on host" but mounted into vmware, which makes everything terrible slow. so having code inside the VM is 500% faster. maybe you should take a look to laravel octane - because here, everything stays in memory and nothing gets loaded again and again for each new request. of course, it has some downsides and other things you have to take care of, but when it comes to speed, i guess octane will be much much faster than your current solution - even if the code IS NOT inside your container ;)

Thread Thread
tylerlwsmith profile image
Tyler Smith Author

Thanks for the tip! I've been REALLY interested in Octane since Taylor announced it, but I haven't had a chance to dig into it yet. What are the downsides you've run into with Octane?

Thread Thread
michabbb_76 profile image
Michael Bladowski

i am not using octance right now, but i am planning to use it for an api to create images on the fly. i have read a lot about it, but i cannot give u any detailed examples right now. in general: code that stays in memory (forever) is always a challenge - you have to write clean code and take a lot of care about everything - if i remember correctly, you should avoid static calls, because those can make problems. but you have to read some stuff about it, there is already plenty to read about it and also existing docker images, so you can start in a minute ;)

Thread Thread
tylerlwsmith profile image
Tyler Smith Author

I spent a year writing Node.js, so I know some of the gotchas of things like global mutable state. Hopefully Octane will feel kind of familiar from that.

Thread Thread
michabbb_76 profile image
Michael Bladowski

BTW, I guess statics are not a problem, it could be singletons, found this article, very interesting:

developpaper.com/first-experience-...

Thread Thread
michabbb_76 profile image
Michael Bladowski

Also helpful: youtu.be/T5lkBHyypu8