Is compile time part of execution time ?

I’m new to codechef, I just submitted a really simple piece of Java code. The execution time is more than 5 seconds on codechef. This is way too long for a code that simple.

Is compile time part of execution time ?

thanks

1 Like

no it is not a part.

1 Like

No its not a part…
As far as i m concerned,tht tym is high because your program is tested against really big input size…

These links can be helpful…

2 Likes

I’m not sure if there’s something wrong with Code Chef’s execution platform for Java, but a very simple Java program used 177.7MB of memory and took 3.29 seconds to execute for me. On the other hand, the same program in C++ used 2.8MB of memory and took 0.01 seconds to execute.

Ok, so why is the execution so long ?

Maybe the server was overloaded when I submitted the code.

I don’t think we can rely on execution time as a valid criteria for ranking if it is not accurate.

Java consumes so much memory, because there is JVM memory included…

1 Like

I ran my code with 2MB of max heap size with no problem. Java doesn’t consume that much memory.
If you run a JVM with default params, the minimum heap size will be 128MB.

JVM memory is not only the heap, there are other classes loaded on startup too, not only yours…

1 Like

I know. My point is : running java with default params and saying it consumed 177.7MB of memory is irrelevant.

Thank you for your response. I’m still surprised though : I ran the code on my machine in a worst case scenario as described in the problem (10000 cases with values up to 1000000000). It ran in less than 400ms !

Can you plz. tell the question…
Maybe its because of slower I/O fuctions you are using…
Or maybe as you are saying Server was Overloaded.

@rxitr,

Are you sure that what you think is the worst case scenario is in fact the worst case scenario? Very often, it is not only the number of values that determine the complexity, but the actual values matter as well.

If the problem you are solving is not part of a running competition, it makes a lot of sense to tell what problem you are solving and publish your code…

1 Like

@renze

Sure. It’s the “Double Strings” problem, and you can view my Java submission here : CodeChef: Practical coding for everyone

I also tried to submit a bash version of the code, hoping it would be faster : CodeChef: Practical coding for everyone but it timed out… It seems I’m the only one to submit bash scripts here… :slight_smile:

As you can see, it’s a very simple piece of code.

My test case contains random 10000 values between 1 and 1000000000.

By the way, I will try an other problem and see if I’m more lucky.