performance work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-25 15:49:05 -04:00
parent 545fb1ee8a
commit 9a223159e5
6 changed files with 8 additions and 51 deletions

View File

@ -1989,6 +1989,7 @@ Performance improvements
- Shallow clone on physics cell creation
- More vector pool usage
- Model anim calculations no longer allocate new matrix4d's
- Undo most object pooling
Increase human move speed
LOD components re-attach physics
VectorPool->JomlPool

View File

@ -6,8 +6,6 @@ import java.util.List;
import org.joml.Quaterniond;
import org.joml.Vector3d;
import electrosphere.mem.JomlPool;
/**
* Converts data structures between formats saved to disk vs formats used in engine
*/
@ -45,12 +43,12 @@ public class DataFormatUtil {
*/
public static Vector3d getDoubleListAsVector(List<Double> values){
if(values == null){
return JomlPool.getD();
return new Vector3d();
}
if(values.size() > 0){
return JomlPool.getD(values.get(0),values.get(1),values.get(2));
return new Vector3d(values.get(0),values.get(1),values.get(2));
} else {
return JomlPool.getD();
return new Vector3d();
}
}

View File

@ -6,7 +6,6 @@ import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityTags;
import electrosphere.entity.EntityUtils;
import electrosphere.logger.LoggerInterface;
import electrosphere.mem.JomlPool;
import electrosphere.renderer.actor.Actor;
import electrosphere.server.datacell.ServerDataCell;
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
@ -347,7 +346,7 @@ public class AttachUtils {
Vector3d parentScale
){
//transform bone space
Vector3d position = JomlPool.getD(offsetVector);
Vector3d position = new Vector3d(offsetVector);
position = position.rotate(new Quaterniond(boneRotation));
position = position.add(bonePosition);
position = position.mul(parentScale);

View File

@ -26,7 +26,6 @@ import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.attach.AttachUtils;
import electrosphere.entity.state.hitbox.HitboxCollectionState.HitboxState.HitboxShapeType;
import electrosphere.logger.LoggerInterface;
import electrosphere.mem.JomlPool;
import electrosphere.server.datacell.Realm;
import electrosphere.server.entity.poseactor.PoseActor;
import electrosphere.util.math.SpatialMathUtils;
@ -462,7 +461,7 @@ public class HitboxCollectionState {
Quaterniond offsetRotation = new Quaterniond();
//the bone's transform
Vector3d bonePositionD = JomlPool.getD();
Vector3d bonePositionD = new Vector3d();
if(bonePosition != null){
bonePositionD.set(bonePosition);
}
@ -471,7 +470,7 @@ public class HitboxCollectionState {
//the parent's transform
Vector3d parentPosition = EntityUtils.getPosition(parent);
Quaterniond parentRotation = EntityUtils.getRotation(parent);
Vector3d parentScale = JomlPool.getD();
Vector3d parentScale = new Vector3d();
parentScale.set(EntityUtils.getScale(parent));
//calculate
@ -480,11 +479,6 @@ public class HitboxCollectionState {
//actually set value
PhysicsEntityUtils.setGeometryOffsetPosition(collisionEngine, geom, hitboxPos, new Quaterniond());
//free vecs used in computation
JomlPool.release(bonePositionD);
JomlPool.release(parentScale);
JomlPool.release(hitboxPos);
}
/**

View File

@ -73,41 +73,6 @@ public class JomlPool {
return rVal;
}
/**
* Gets a Vector3d from the pool. Allocates if no free one is available.
* @param source The source to copy from
* @return A Vector3d
*/
public static Vector3d getD(Vector3d source){
Vector3d rVal = null;
lock.lock();
if(vec3dPool.size() > 0){
rVal = vec3dPool.remove(0);
} else {
rVal = new Vector3d();
}
rVal.set(source);
lock.unlock();
return rVal;
}
/**
* Gets a Vector3d from the pool. Allocates if no free one is available.
* @return A Vector3d
*/
public static Vector3d getD(double x, double y, double z){
Vector3d rVal = null;
lock.lock();
if(vec3dPool.size() > 0){
rVal = vec3dPool.remove(0);
} else {
rVal = new Vector3d();
}
rVal.set(x,y,z);
lock.unlock();
return rVal;
}
/**
* Releases a Vector3d back into the pool
* @param data The object to release

View File

@ -887,7 +887,7 @@ public class Actor {
}
Globals.profiler.beginAggregateCpuSample("Actor.isWithinFrustumBox");
Sphered sphere = model.getBoundingSphere();
Vector3d modelPosition = model.getModelMatrix().getTranslation(JomlPool.getD());
Vector3d modelPosition = model.getModelMatrix().getTranslation(new Vector3d());
boolean check = renderPipelineState.getFrustumIntersection().testSphere((float)(sphere.x + modelPosition.x), (float)(sphere.y + modelPosition.y), (float)(sphere.z + modelPosition.z), (float)sphere.r);
JomlPool.release(modelPosition);
Globals.profiler.endCpuSample();