Software Performance Gains

I would like to remind the World there is potential for Huge Speed Increases via writing More Performance Software. Testing Performance Early on can go a long way in enabling a system that is performant.

Also important to remember More Performance does not always equal More Verification. Extra cycles can help enable more Verification, faster Verification. Faster Testing equals faster ability to get a product to shelves.

Free Starter Java Class

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) {
		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);
	}
	
	public ArrayList<PerformanceReading> getPerformanceReadings() {
		return performanceReadings;
	}
}

Something to note Java Vector API and Project Loom are not giving me Performance Increases at the level I would expect. Might be particular to my context (I am rendering in graphics and JavaFX). Lightweight Java Graphics library has potential though my experience getting it running swiftly has been more than problematic.

https://www.lwjgl.org/

Needs functional example code

I had more performant OpenGL C++ code running in 2003 than I am able to create on LWJGL currently, and my access to that code is being non ideally limited. System gives feeling of bad deal not fully appreciated.

JavaScript can run Quake and I am being limited from running simple 3d apps in Java? What gives seems apt.

The experience gives feeling of bad deal.

Published by techinfodebug

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

Leave a comment