This tool built with VS 2019 allow you to disable Threaded optimization using a single command line:
SetNvidiaSettings "Profile Name" "executable_name.exe" "Nice description of the profile"If you can't download from link just download from the Release folder ;)
This executable was built upon subGlitch's answer in the following issue: Nvidia graphics driver causing noticeable frame stuttering
Nuri Yuri just made an exe out of that for the purpose of its own projects.
You should be able to boot up a VS 2019 solution from this repository but it hasn't been tested...