For privacy or reducing browser fingerprinting: CPU and GPU information are only part of a larger fingerprint. Spoofing them can actually make your device stand out if the reported values are inconsistent with the rest of your system.
For software testing: It’s usually better to use virtual machines, emulators, or developer tools that simulate different hardware configurations instead of spoofing your actual hardware.
For compatibility testing: Changing application settings or using a VM is typically more reliable than spoofing hardware identifiers.
If your goal is to avoid tracking or improve privacy, focusing on standard privacy features (such as a privacy-focused browser, limiting unnecessary permissions, and keeping software updated) is generally more effective than spoofing CPU or GPU details.
What are you trying to accomplish by spoofing the CPU or GPU? That will determine the safest and most appropriate approach.