Thread: Command for making a program execute faster

  1. #1
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197

    Command for making a program execute faster

    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?

    Thanks,
    Nyah

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    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.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. execute the run command from c program ...?
    By sma88 in forum C Programming
    Replies: 2
    Last Post: 02-22-2010, 09:35 AM
  2. tips on making my program faster?
    By jackhasf in forum C Programming
    Replies: 4
    Last Post: 10-25-2009, 06:32 AM
  3. making multiset destructor faster...
    By bling in forum C++ Programming
    Replies: 2
    Last Post: 08-30-2008, 11:56 AM
  4. Replies: 8
    Last Post: 09-16-2006, 01:18 PM
  5. making programms faster
    By deian in forum C Programming
    Replies: 23
    Last Post: 10-09-2004, 12:19 AM