-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPUNIT very slow in Homestead #36
Comments
If you can use Valet, use it. :p Homestead is a joke for regular websites. |
Yeah everything is miles faster if you can run PHP right on your normal machine, like we do with Valet. For apps I'm running locally, I get about a ~10ms response time on most pages, whereas using a virtual machine, it would often be 300-400ms, sometimes more! Virtual machines are just really, really slow sadly 😔 |
Try running phpunit from your local machine directly. My tests are about 2-3 times faster locally compared to within Homestead. |
Sadly at work (doing good old java + jsp + oracle), they got me a PC laptop. I have to use Homestead + cmder working on my personal stuff 😎. It's so damn slow 😒 |
I'm on Windows as well, @jartaud. Running |
@AdamEsterle Here's how I tackle it: a) I use Valet for all my normal development work. This lets me do blazing fast unit/integration testing too. b) In the rare occasions where I need to have an exact clone of the Production Server, I use a virtual machine, often Homestead. I'm finding this is less and less necessary all the time ... but that's usually because I have DevOps access to the production server, or have easy access to the person who does. If it was more of a "black box" and had some very specific configuration needs that I couldn't emulate sufficiently in Valet, then I'd need a virtual machine. Further, I also find that most of my deployments happen over Forge ... so if I need a clone, then Homestead is an easy grab. But even then, Valet is still adequate in 99% of cases. I definitely prefer Valet over Homestead, both for speed and simplicity. |
@svenluijten Running |
@jartaud I use git bash. Works nicely. But for my actual workflow, I run my tests in PhpStorm. Easy hotkey setup to run: single test, the whole file, or just failed tests. |
@adamwathan do you know of any reasons why tests would be running slow when running directly from my mac? I have the same code on both Windows and Mac and my Mac is running the tests a lot slower. Around 9 seconds compared to 900ms on Windows. I have been trying to debug without much luck. |
@coxy121 Hmm not sure, the first thing that comes to mind is checking if you have XDebug installed/enabled on your Mac; it really slows things down a lot. You can use |
@adamwathan thanks. I removed xdebug and that took about 1 second off the total time, so is now runs 9 test in about 8 seconds. So still a lot slower than on my Windows set up at 900ms. I rebooted and ran phpunit as soon as system started up which ran the tests in less than 2 seconds, a few minutes later it was back to running at 8-9 seconds. So seems like I may have something else running that may be slowing it down. |
Don't use Homestead but rather a local web server like MAMP.
Also, use the pathcache option in the php.ini it makes it really faster. And try to use PHP7 if you can.
All in all, your Mac should be a lot faster since it uses Linux file system.
Envoyé de mon iPhone
Le 19 févr. 2017 à 17:54, Lee <[email protected]<mailto:[email protected]>> a écrit :
@adamwathan<https://github.com/adamwathan> thanks. I removed xdebug and that took about 1 second off the total time, so is now runs 9 test in about 8 seconds. So still a lot slower than on my Windows set up at 900ms.
I rebooted and ran phpunit as soon as system started up which ran the tests in less than 2 seconds, a few minutes later it was back to running at 8-9 seconds. So seems like I may have something else running that may be slowing it down.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#36 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AHUtzEj4KENxsXUlKLGsYGyENVN9UFsgks5reHPFgaJpZM4L-QnD>.
|
hey i am having the same problem on my windows pc, if i run the laravel testcase i get around 500-900ms for a single PHP 7.1.5 not runnig in homestead or anything special just plain cmd prompt tested with |
strace points me to I restored |
Do you have OPCache enabled |
@mikeerickson would OPCache speed it up or slow it down? |
@adamwathan
Do you have recommendations on where to run your tests?
I use homestead on both my mac and windows and it is very slow
Homestead is configured to have 8GB ram and 4 CPUs. It is also on the latest version (1.1.0)
Your whole test suite (except the Stripe tests) runs in about 500ms when you run
phpunit
When already SSH'ed into Homestead:
$this->assertTrue(true);
in the methodIt takes 2 seconds
I am going to use your "DatabaseSetup" trait, but that still does a migration
So bottom line is that a single test takes at least 4 seconds to run
Thoughts?
Should I run phpunit on my Mac/Windows instead of inside Homestead?
UPDATE
Just put
type: "nfs"
in my Homestead.yaml fileIt is faster (1.5s instead of 4s and .5s instead of 2s (without migrations)), but still nothing like what you are running
UPDATE 2
Running
phpunit
on my host (mac) is blazing fast.90ms for just the test and 350ms with a migration
So that seems to solve the problem. But is there a way to solve it and still use Homestead? It would be nice to not have to worry about what is installed on your host machine.
Tangent
After installing php on my host and seeing how blazing fast the tests were, it makes me think: Should I just stop using Homestead and start using Valet? Perhaps the rest of my application would be way faster without Homestead?
The text was updated successfully, but these errors were encountered: