Java execution speed

I am new to Java programming.
I am curious about the speed of execution, as well as the speed of creating and destroying objects.
I have several methods:

private static void getAbsoluteThrottleB() {
    int A = Integer.parseInt(Status.LineToken.nextToken());
    Status.AbsoluteThrottleB=A*100/255;
    Log.level1("Absolute Throttle Position B: " + Status.AbsoluteThrottleB);
}

and

   private static void getWBO2S8Volts() {
        int A = Integer.parseInt(Status.LineToken.nextToken());
        int B = Integer.parseInt(Status.LineToken.nextToken());
        int C = Integer.parseInt(Status.LineToken.nextToken());
        int D = Integer.parseInt(Status.LineToken.nextToken());
        Status.WBO2S8Volts=((A*256)+B)/32768;
        Status.WBO2S8VoltsEquivalenceRatio=((C*256)+D)/256 - 128;

        Log.level1("WideBand Sensor 8 Voltage: " + Double.toString(Status.WBO2S8Volts));
        Log.level1("WideBand Sensor 8 Volt EQR:" + Double.toString(Status.WBO2S8VoltsEquivalenceRatio));

Would it be wise to create a separate data processing method as it repeats itself? Or would it just be executing it as a single method? I have a few that need to be rewritten, and I wonder if this will actually improve the execution speed or if it is just as good or if there are several instructions when it becomes a good idea to create a new method,

Basically, what is faster or when it becomes faster to use one method for processing objects in comparison with another method for processing several similar objects?

, , , , , varible, . , ..

Status.Variable. 200 , .

+3
3

. .

, , . , - , , / 50 , ( ), ,

, , , ( , VM )

+4

, .

Java , , .

Java ... . , , .

, ?

, .


@S.Lott : ", -". , , , . "" , .

+1

, . , , - , , . , , , , .

Support, ( , , ). , JIT ( , - /JIT Java, ).

However, there is one advantage of a separate approach to the method: if you separate your data processing code into a separate method, theoretically you can achieve some improved performance by calling this method from a separate thread, thereby separating your (possibly a lot of time) processing code from your another code.

+1
source

Source: https://habr.com/ru/post/1751105/


All Articles