View Full Version : Command for making a program execute faster

Nyah Check
04-11-2014, 04:27 PM
Hi guys,

just wrote this piece of code dealing with incredibly large numbers and i'm executing on this server which is looking incredibly(Really strange). I wish to ask if there are any commands I could give the server in addition to the executable to make it execute faster?


04-11-2014, 04:52 PM
Look up the nice command. Although, by default, it causes a program to be scheduled at lower priority, it can be used to boost process priority.

Bear in mind that;

1) It makes no difference unless the system is loaded (other processes consuming CPU resources) - it doesn't magically make a program able to run faster than the host system can support, or cause a program that is already getting access to the majority of system resources to get access to more.

2) By default, the ability of users to boost process priority is limited, and an administrator can easily limit things further. Abusing the facility is an effective way to lose access to it.

3) In practice, the most likely effect of boosting priority of a process is to slow down other programs YOU are running.

You might want to look into build options (e.g. compiler optimisation when building your program, stripping executables, and things like that) and techniques such as profiling your executable and identifying parts of your code that can be better optimised for performance. While there are trade-offs (compiler optimisations often expose bugs in your program, so a program that seems to run correctly can behave incorrectly after compiler optimisation) you'll probably get more benefits from those things than boosting process priority.

04-14-2014, 06:08 AM
if your program can be multithreaded, and you have hardware that can execute multiple threads simultaneously, consider breaking it up into chunks and process each chunk in its own thread, up to as many threads as the hardware supports.