Improve the speed of executing an executable file

I am using HP Trusted OS v10.26
I have an executable file named "test" of size of 10MB.
I put a system("date") command in my first line of my code
eg main()
I create a script file run.exe with the following:

When I run this script, I found out that the date in the first line of the script and the date in the first line of the executable file is 5-8seconds.

My boss wants to run the executable file and complete within less than 5 seconds but this alone has already taken 5-8 sec.
Can anyone provide me with a solution on how to reduce the speed of the
execution? Thanks
Who is Participating?

Improve company productivity with a Business Account.Sign Up

ahoffmannConnect With a Mentor Commented:
1. insert more RAM
2. use a faster disk
3. compile/link as shared executable
4. replace system() by the appropriate libc-call, for example: time()
What language is the executable written in?

You may want to break it up into smaller programs, or make it more modular.  It's hard to give good advice without know what the test program does or in what manner it was written.
wmlim060298Author Commented:
The program is written in C++. Anyway, does it matter what language is it written in?
This is because I want to improve the speed of the program from the time it is executed to the time the execution starts, i.e. the main command in the main() is not called yet.
Look at my script.

I think maybe it is due to the loading of the program into the memory before execution that takes such a long time, is there any where I can improve this time?

I cannot break the program up, this is the optimised size. I even strip the executable file.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

beware at the name test, which is a reserved word of the shell;

HP needs more and more processes, sometimes for only a job;

try to use system calls to obtain the time rather than the system routine that need to launch another shell

try to identify where you loss so much time: in the program itself, or in the calling of the system function: to do that, make a short cut in your program;
in this maneer, you can found the part of your program where you loss so much time.

use the top command and the sar command to survey the time consumption in your system

good luck !
> try to identify where you loss so much time: ...
it's obvious: 10MB need to be loaded first
beside my suggestions 1. .. 3. you also may tune the kernel how it distributes the timeslices for each process
wmlim060298Author Commented:
I cannot  insert more RAM because no more money to buy more RAMs.
I cannot buy faster disk also because of same reason
I have already compile/link my exeuctable file using shared library
To replace system() by the appropriate libc-call, for example: time() is not a solution for me to solve my problem.

However, I think tuning the kernel maybe able to solve my problem. Please advise me on this tuning. How can I do it?
which OS, which shell?
oops, have just seen HP 10.26 in the question. Sorry no expert-experiance with this for kernel tuning.
But you may try to stop as much processes as possible, and then try again to start your applikation.
Start your applikation with the time command, several times close to each other, and post the results.

> .. time() is not a solution for me to solve my problem.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.