I m new to Java programming.
I am curious about speed of execution 以及 also speed of creation 以及 distruction of objects.
I ve got several methods like the following:
private static void getAbsoluteThrottleB() {
int A = Integer.parseInt(Status.LineToken.nextToken());
Status.AbsoluteThrottleB=A*100/255;
Log.level1("Absolute Throttle Position B: " + Status.AbsoluteThrottleB);
}
以及
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("WideB以及 Sensor 8 Voltage: " + Double.toString(Status.WBO2S8Volts));
Log.level1("WideB以及 Sensor 8 Volt EQR:" + Double.toString(Status.WBO2S8VoltsEquivalenceRatio));
Would it be wise to create a separate method to process the data since it is repetative? Or would it just be faster to execute it as a single method? I have several of these which would need to be rewritten 以及 I am wondering if it would actually improve speed of execution or if it is just as good, or if there is a number of instructions where it becomes a good idea to create a new method.
基本上,使用单一方法处理物体与使用另一种方法处理类似物体时,越快或越快?
It seems like at runtime, pulling a new variable, then performing a math operation on it is quicker then creating a new method 以及 then pulling a varible then performing a math operation on it. My question is really where the speed is at..
These methods are all called only to read data 以及 set a Status.Variable. There are nearly 200 methods in my class which generate data.