Ryzen benefits from faster speed. Having said that, having a lower latency will give you better performance. So, its basically a balance of both.
Like, 3600mhz cl16 would be the sweet spot. In the scenario where you have to choose between, lets say 3600mhz cl18 and 3200mhz cl16, theoretically the 3600mhz cl18 should be a tad better. But how much of a difference you will actually see in real time is debatable.
Both really, but the speed has a bit better benefits over latency on Ryzen, Get the speed up, chances of you getting more than 4000mhz ram speed is going to be slim, So you'll probably land around 3800mhz or so stable on Ryzen.
Once you figure out what speed is stable, save the profile and play with the latency to get even more gains.