If your program is mainly limited by the CPU, then the performance will obviously depend a lot on the specific CPU model. But you should check whether any other processes running on the systems "steals" CPU cycles. With Taskmanager (Windows) or htop (Linux) you can easily find processes using the most CPU time.
If, instead, your program is limited by RAM usage, it could easily happen that performance drops drastically, when the system runs out of "free" RAM: As soon as all RAM is used up, the system will start swapping out data to the HDD (or SSD), which is really slow! In that case only more RAM can help to resolve the bottleneck. Of course, you should also scan the system for other processes that are "hogging" a lot of memory.
Finally, if your program performs a lot of I/O, e.g. read from and/or write to the disk, then the "speed" of the HDD or SDD can make a huge difference. You almost certainly want an SDD these days. But some (especially cheap) SSDs can be really slow when it comes to write operations....
(Does the program perform any network operations and/or access a network drive?)
Indeed, find the issue.
In gaming, there are several key places where that thing that players calll 'lag' generically shows up.
the big ones are
-network
-cpu
-disk activity
-graphics
-memory (which is really tied to disk, as observed above)
- heat (if set that way a hot PC will automatically run slower until it cools back down)
- power (as with heat, a PC set to manage power incorrectly will throttle itself down)
Use a shot-gun or some other area weapon. Even if you don't get a direct hit the frag/pellet spread will do some damage. The buggers may be sloth-like normally, but do tend to get a burst of adrenaline when attacked.
To be really effective in neutralizing a computer that has developmental issues, use a nuke.
George P, the link I posted was the original post of the other one it copied from. I didn't want to link OP's other posts since that just helps its goal (it links to commercial links).