The reason for the huge performance difference is because by default, MATLAB falls back to SSE1 when it detects an AMD processor. The application uses the Intel Math Kernel Library, which does not use SSE3-SSE4 or AVX1/2 extensions. Via a coupe of lines of code, users can ensure that MATLAB enforces AVX2, independent of the vendor string result. Details can be read at Reddit.
The tweak, meant to be manually applied by AMD Ryzen users, forces MKL to use AVX2 regardless of the CPU Vendor ID query result. The tweak is as simple as it is powerful. A simple 4-line Windows batch file with a set of arguments starts MKL in AVX2 mode. You can also make the tweak "permanent" by creating a system environment variable. The environment variable will apply to all instances of MATLAB, and not just those spawned by the batch file.