0

i came to know that java applications performance is also based on speed of the JVM that executing the byte code.So, I would like to know JVM speed while executing byte Code.Is this possible?

3
  • 3
    What do you mean by "JVM speed" exactly?
    – Jon Skeet
    Jan 6, 2012 at 13:28
  • Yes. my programs run faster when my computer is on the train. They suddenly slow down when I'm at my desk :-) Seriously, your question makes no sense. Do you think there is a possibility to make a JVM slower or faster, and that some method would return the speed?
    – JB Nizet
    Jan 6, 2012 at 13:29
  • @JBNizet Really, I would have thought your laptop was faster on mains power. ;) Jan 6, 2012 at 13:39

3 Answers 3

2

The JVM speed varies as it runs, i.e. it optimises the code it executes more the more often it is run.

You can write a micro-benchmark which you can measure and compare with other system.

Perhaps you could clarify why you need to know this?

1
  • @ Peter Lawrey:Sorry Peter, yesterday, i read one book about the matter we discussed.That's why i asked...
    – Saravanan
    Jan 6, 2012 at 13:37
1

first of all beware while reading some Java performance related material , you may find black, white, grey , depending from the creation date , the JVM used and so on... Don't try to deliver overkilled applications , performance should remain a question of logic and should not induce to have a non human understandable code... What do you mean with JVM speed ? JVM speed depends from many parameters: * size of byte code * performance of CPu used * tuning of the OS and the JVM * code you write

The main Java advantage remains portability (WORA acronym) so trying to write code behaving in different ways following one 'speed' parameter would be the worth thing to do ....

You may access to different of those parameters (JVM version, CPU , memory and so on) but to do what ? I totally agree with Peter Lawrey in this point....

I guess that you are a Java newcomer and you try to learn quickly , very good.. But try to put things in order.... Starting with writing code that works in a clear, robust and efficient way , easy to maintain is a very good starting point (life's work ????)

HTH My 2 cents Jerome

1

Best to use a profiler to work with,

Some reasons why your machine (probably jvm) works faster is due to a different power savings system your machine employs, eg, no bluetooth, wifi etc. However, this is disputable.

If you use Linux/Unix or any gnu tools, use the 'time' command, eg, time java classname to get the exact time it takes to execute the process.

But from my experience, I feel that I was more alert / productive working out of my office, hence seeing my laptop perform faster. perhaps its physiological.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.