java - Object vs byte[0] as lock -


I commented first ("why java.lang.Object is not abstract?") Stating that I have heard that one Byte [0] was slightly more efficient as a lock using a java.lang.Object . I'm sure I've read it somewhere, but I can not remember: Does anyone know that this is really true?

I suspect that this requires a bit byte code compared to byte [0] / code> to object , although it was reported that the < To store code> byte [0] length field requires additional storage and therefore it seems it can reject any benefit

I was curious enough to test this. Source code:

  test for public class {public static object return object () {new object returns (); } Public stable byte [] Return back () {new byte [0]; }}  

Bytecode:

  public static java.lang.Object returnObject (); Code: 0: new # 2; // Class Java / Long / Object 3: Dip 4: Investigator # 1; // method java / lang / object "& Lt; init & gt;" :() V7: Public Static Byte [] Return Back; Code: 0: IconStage 1: Newer byte 3: Current  

So you are right that the byte code is small for arrays, because array creation has its own JVM session but what does that mean is? nothing really. This is a virtual machine, so there is no guarantee that less bytecode instructions mean less work for actual physical CPU. We can start the outline of the course, but it will be quite useless. It does not make any difference if it does not matter, it will never talk any thing. Object creation is incredibly fast nowadays before you can also calculate the total time, you may be able to for your loop index Long time to start using .


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -