nothingworksinc / ticketbeast

Back to the lesson videos:
https://course.testdrivenlaravel.com/lessons
552 stars 11 forks source link

Reduce the number of rounds Hash makes for testing to speed up test suite #75

Closed bencarter78 closed 6 years ago

bencarter78 commented 6 years ago

Hello

I've been using this for a while but I also saw Taylor tweet about this recently. For me, on a new iMac running the entire test suite, it gives me about a 40% speed increase.

adamwathan commented 6 years ago

Hey @bencarter78! Yeah this is an awesome improvement; I'm not going to merge the PR because I want to keep the commit history clean and matching the lessons, but thanks for bringing it up either way 👍

You can get similar or better improvements by just using a pre-hashed password as well, which is what Laravel is doing by default now:

https://github.com/laravel/laravel/blob/master/database/factories/UserFactory.php#L20

Funnily enough I suggested this in a PR a year and a half ago, but we made the mistake of switching to a static variable thinking the performance implications would be the same (they weren't 😜):

https://github.com/laravel/laravel/pull/3894/commits/b041a0387808bb90ffa56308c70665e1c8d01efd