March 24th, 2023 Pt 2

Imagine the Perfect Book, if the Perfect Book Existed.

Access to the book, throughput from the book requires having the book.

If you have the book hours in advance, that can allow you to read the book, or to put the book on the shelf.

Comprehension Throughput Amped over time has the potential for critical throughput increases at critical times. Less investment in Comprehension Throughput is not something that can just be enabled in an instant.

Ability to Test Performance Swiftly factors into Performance Delivered or Performance Lagged. Great tools that enable performance freely not always a given.

Free Starter Java Classes, MIT License

package performance;

import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;

public class PerformanceUtil {
	private ArrayList<PerformanceReading> performanceReadings = new ArrayList<>();
	private boolean stopWatchStarted = false;
	public boolean isStopWatchStarted() {
		return stopWatchStarted;
	}

	private long startTime;
	private long endTime;
	private long recordedTime=0;
	private static PerformanceUtil instance;
	
	public static PerformanceUtil getInstance() {
		if (null == instance) {
			instance = new PerformanceUtil();
		}
		
		return instance;
	}
	
	private Instant start;
	private Instant stop;
	
	public void startInstant() {
		start = Instant.now();
	}
	
	public void stopInstant() {
		stop = Instant.now();
	}
	
	public long getInstantDifferenceMilliseconds() {
		return Duration.between(start, stop).toMillis();
	}
	
	public boolean start() {
		if (stopWatchStarted) {
			return false;
		} else {
			startTime=System.nanoTime();
			stopWatchStarted=true;
			return true;
		}
	}
	
	public boolean stop() {
		if (!stopWatchStarted) {
			return false;
		} else {
			endTime=System.nanoTime();
			stopWatchStarted=false;
			return true;
		}
	}
	
	public long getRunningTime() {
		long runningTime = System.nanoTime()-startTime;
		return runningTime;
	}
	
	public long getRecordedTime() {
		recordedTime=endTime-startTime;
		return recordedTime;
	}
	
	public int getRecordedTimeMilliseconds() {
		recordedTime=endTime-startTime;
		double milliseconds = recordedTime/1000000;
		return (int) milliseconds;
	}	
	
	public void clearPerformanceReadingsList() {
		performanceReadings = new ArrayList<>();		
	}
	
	public void addPerformanceReading(String performanceReadingName) {
		long recordedTime = getRecordedTime();
		PerformanceReading performanceReading = new PerformanceReading(recordedTime, performanceReadingName);
		performanceReadings.add(performanceReading);		
	}
	
	public PerformanceReading summarizePerformanceReadings(String readingName, ArrayList<PerformanceReading> readings) {
		if (readings.size()>0) {
			long sum=0;
			for (int i=0; i<readings.size(); i++) {
				sum = readings.get(i).getNanoseconds();			
			}
			long average = sum/readings.size();
			
			return new PerformanceReading(average, readingName);
		} else {
			return null;
		}
	}
	
	public ArrayList<PerformanceReading> getPerformanceReadings() {
		return performanceReadings;
	}
	
	public static PerformanceReading runAndTime(String name, Runnable method) {
		PerformanceUtil perfUtil = new PerformanceUtil();
		perfUtil.startInstant();
		method.run();
		perfUtil.stopInstant();
		PerformanceReading performanceReading = new PerformanceReading(0, name);
		String timingMessage = "System required "+perfUtil.getInstantDifferenceMilliseconds()+" ms to execute "+name;
		performanceReading.setMilliseconds(perfUtil.getInstantDifferenceMilliseconds());
		performanceReading.setMessage(timingMessage);
		return performanceReading;
	}
}
package performance;

public class PerformanceReading {
	
	public PerformanceReading(final long nanoseconds, final String name) {
		this.nanoseconds = nanoseconds;
		this.name = name;
	}
	
	private long nanoseconds;
	private String name;
	private String message;
	
	public String getMessage() {
		return message;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String toString() {
		return message;
	}
	
	public long getNanoseconds() {
		return nanoseconds;
	}
	
	public long getMilliseconds() {
		return TimeMeasurementUtil.convertNanosecondsToMilliseconds(nanoseconds);
	}
	
	public void setMilliseconds(long milliseconds) {
		nanoseconds = TimeMeasurementUtil.convertMillisecondsToNanoseconds(milliseconds);
	}
	
	public String getName() {
		return name;
	}	
}

Able to Time and Measure Performance Swiftly Accurately factors into Throughput, because humans can’t easily perceive very small time differences. Adding results over a period of time can improve comprehension.

Rendering 1 frame might be not fully perceivable. Rendering 10,000 frames could be minutes of difference.

10,000 frames at 60 frames per second, 10,000/60 = 166 seconds approx 3 minutes

10,000 frames at 20 frames per seconds, 10,000/20 = 500 seconds, 600 seconds would be approx 10 minutes – 60 – 40 approximately 8 and 1/3 = 8.333 (rounded) minutes

5 minutes difference, a 5 minute head start can be huge

Having the class available, tried, tested in advance, can be potentially an hour of saved development time. Trying to deliver performance having access to code in advance can be huge. Factors into ability to deliver performance gains, potential for a business to deliver vs not deliver, potentially in way that keeps the lights on vs off.

Knowing what a class, a piece of code adds vs does not add takes time and investment. Investment that latency can’t enable, except through investing in up front. Investment that has the potential to lead to less latency, less latency at critical times. Improved latency requires less latent choices in advance that increase throughput. Like training for a marathon or sitting on the couch.

A week from now, if I just sat on the couch, potential for less ability to walk, potential for blood to have moved less, potential for my future to be enabled less.

On the other hand, if I make a reduced latency choice to pay future me with a walk on this day, then I have made a change that has the potential, not guarantee to lead to reduced latency for greater throughput in advance.

Systems more enabled with Operability can be a lot of Power

https://en.wikipedia.org/wiki/Interoperability

Systems are integrated clearly in a comprehensible by all way?

Published by techinfodebug

Flex and Java Developer, Christian, Art, Music, Video, and Vlogging

Leave a comment