Solved

Java/C: Code running longer and longer

Posted on 2008-06-16
6
183 Views
Last Modified: 2013-11-23
Hi experts,

I am puzzled with this so I post to get explainations. I have Java and C code on Linux machine. I found that the Java code cost more and more time. It is the same for the C code. I wrote this C code about one month ago and did not touch it since then. Today I run it and found the running time got doubled. I used clock() to measure time.

How can this code run with longer time? or why do they become slow?

Thanks for any replies.
0
Comment
Question by:davidw88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 50 total points
ID: 21797713
Can you tell us anything about the code?
Does the code read any data?
Does the code do different things depending on the date?
Was the machine doing anything else while the code was running?
Can you show us the code in question?
0
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 21798323
Could be other processes taking up more resources on your box

0
 
LVL 11

Assisted Solution

by:spoxox
spoxox earned 100 total points
ID: 21798491
Java and C are deterministic languages. If the same thing goes in, the same stuff comes out. Barring any element of randomness, the same CPU effort is required. Clock does not measure how much CPU your program is using. It tells you how much time has elapsed.

The program's running time can be influenced by:

1) data input/output. If the program reads a file, changes in the file will affect the running time.

2) environmental changes. If system RAM increases or decreases; if the CPU or instruction pathways have changed; if available RAM increases or decreases (owing to the execution of other processes); if the i/o system is changed; if any hardware is failing, the running time will change. O/S changes (operating system processes) can also affect the running time.

Most influencing factors should fall under one of these two broad categories.
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 9

Expert Comment

by:mbodewes
ID: 21798719
In all my performance problems so far with Java and even C, the best bet is to disable the virusscanner. A scanner trying to read every .jar in it's entirety (McAfee) and deleting it if it finds any problems doesn't do much good for developers piece of mind. Stopping your firewall to block connections to/from your own machine may also help.

I cannot see from here if this would fix your problems, try the other possible solutions as well. But at least this solution is one that might work (given the absolute minimum of data you've supplied to us).
0
 
LVL 10
ID: 21799624
Check whether any other processes are running other than java and c. May be because of that reason these programs are taking moretime.
0
 

Author Comment

by:davidw88
ID: 21805089
Hi experts,

Thanks so much for all your replies. I called our administrator to check with me together about the processes. We found that another file writing process took so much resources that it slowed my code!!

Objects, Spoxox and Ozo are correct so I split the points among them.

Thanks also go to mbodewes and melchkishore! (melchkishore's answer follows Objects' so I do not assign points to him.)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question