Created
October 20, 2025 02:37
-
-
Save schosin/e1fd31c2177893a91b59c2cc52eefe2e to your computer and use it in GitHub Desktop.
Generated code for different types of systems in decs benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class ClassProcessingSystemImpl extends EntityProcessorBenchmark.ClassProcessingSystem implements SystemType { | |
| private final InternalWorld _world; | |
| private final Bag<Process> process; | |
| public ClassProcessingSystemImpl(InternalWorld world) { | |
| this._world = world; | |
| this.process = new Bag<>(Process.class, 4); | |
| } | |
| @Override | |
| public final void offerArchetype(EntityArchetype archetype) { | |
| if (Process.COMPOSITION.matches(archetype)) { | |
| this.process.add(new Process(this._world, archetype, this)); | |
| } | |
| } | |
| @Override | |
| public final void runSystem() { | |
| // process(de.schosin.decs.benchmark.components.decs.Position, de.schosin.decs.benchmark.components.decs.Velocity) | |
| Process[] processData = this.process.getData(); | |
| for (int i = 0, s = this.process.size(); i<s; i++) { | |
| processData[i].run(); | |
| } | |
| } | |
| private static final class Process { | |
| private static final Composition COMPOSITION = Composition | |
| .all(Position.class, Velocity.class) | |
| .build(); | |
| private final World _world; | |
| private final EntityArchetype _archetype; | |
| private final IntBag _entities; | |
| private final ClassProcessingSystemImpl _system; | |
| private final Bag<Position> positionData; | |
| private final Bag<Velocity> velocityData; | |
| private Process(World world, EntityArchetype archetype, ClassProcessingSystemImpl system) { | |
| this._world = world; | |
| this._archetype = archetype; | |
| this._entities = archetype.getEntities(); | |
| this._system = system; | |
| EntityArchetypeDataImpl _data = archetype.getData(); | |
| this.positionData = _data.positionData; | |
| this.velocityData = _data.velocityData; | |
| } | |
| private final void run() { | |
| // Return early if no entities | |
| int _s = this._archetype.getAlive(); | |
| if (_s == 0) { | |
| return; | |
| } | |
| Position[] pos = this.positionData.getData(); | |
| Velocity[] velocity = this.velocityData.getData(); | |
| int[] _data = this._entities.getData(); | |
| // Iterate entities | |
| for (int _i = 0; _i < _s; _i++) { | |
| this._system.process(pos[_i], velocity[_i]); | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class InterfaceDefaultProcessingSystemImpl extends EntityProcessorBenchmark.InterfaceDefaultProcessingSystem implements SystemType { | |
| private final InternalWorld _world; | |
| private final Bag<Process> process; | |
| public InterfaceDefaultProcessingSystemImpl(InternalWorld world) { | |
| this._world = world; | |
| this.process = new Bag<>(Process.class, 4); | |
| } | |
| @Override | |
| public final void offerArchetype(EntityArchetype archetype) { | |
| if (Process.COMPOSITION.matches(archetype)) { | |
| this.process.add(new Process(this._world, archetype, this)); | |
| } | |
| } | |
| @Override | |
| public final void runSystem() { | |
| // process(de.schosin.decs.benchmark.components.decs.PositionInterface, de.schosin.decs.benchmark.components.decs.VelocityInterface) | |
| Process[] processData = this.process.getData(); | |
| for (int i = 0, s = this.process.size(); i<s; i++) { | |
| processData[i].run(); | |
| } | |
| } | |
| private static final class Process { | |
| private static final Composition COMPOSITION = Composition | |
| .all(PositionInterface.class, VelocityInterface.class) | |
| .build(); | |
| private final World _world; | |
| private final EntityArchetype _archetype; | |
| private final IntBag _entities; | |
| private final InterfaceDefaultProcessingSystemImpl _system; | |
| private final PositionInterfaceImpl positionInterfaceData; | |
| private final boolean positionInterfaceDataPresent; | |
| private final VelocityInterfaceImpl velocityInterfaceData; | |
| private final boolean velocityInterfaceDataPresent; | |
| private Process(World world, EntityArchetype archetype, | |
| InterfaceDefaultProcessingSystemImpl system) { | |
| this._world = world; | |
| this._archetype = archetype; | |
| this._entities = archetype.getEntities(); | |
| this._system = system; | |
| EntityArchetypeDataImpl _data = archetype.getData(); | |
| this.positionInterfaceData = new PositionInterfaceImpl(archetype.getData()); | |
| this.positionInterfaceDataPresent = archetype.getComponents().contains(PositionInterface.class); | |
| this.velocityInterfaceData = new VelocityInterfaceImpl(archetype.getData()); | |
| this.velocityInterfaceDataPresent = archetype.getComponents().contains(VelocityInterface.class); | |
| } | |
| private final void run() { | |
| // Return early if no entities | |
| int _s = this._archetype.getAlive(); | |
| if (_s == 0) { | |
| return; | |
| } | |
| int[] _data = this._entities.getData(); | |
| // Iterate entities | |
| for (int _i = 0; _i < _s; _i++) { | |
| this.positionInterfaceData.index = _i; | |
| this.velocityInterfaceData.index = _i; | |
| this._system.process(this.positionInterfaceData, this.velocityInterfaceData); | |
| } | |
| this.positionInterfaceData.index = -1; | |
| this.velocityInterfaceData.index = -1; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class InterfaceInlineOptimizedProcessingSystemImpl extends EntityProcessorBenchmark.InterfaceInlineOptimizedProcessingSystem implements SystemType { | |
| private final InternalWorld _world; | |
| private final Bag<Process> process; | |
| public InterfaceInlineOptimizedProcessingSystemImpl(InternalWorld world) { | |
| this._world = world; | |
| this.process = new Bag<>(Process.class, 4); | |
| } | |
| @Override | |
| public final void offerArchetype(EntityArchetype archetype) { | |
| if (Process.COMPOSITION.matches(archetype)) { | |
| this.process.add(new Process(this._world, archetype, this)); | |
| } | |
| } | |
| @Override | |
| public final void runSystem() { | |
| // process(de.schosin.decs.benchmark.components.decs.PositionInterface, de.schosin.decs.benchmark.components.decs.VelocityInterface) | |
| Process[] processData = this.process.getData(); | |
| for (int i = 0, s = this.process.size(); i<s; i++) { | |
| processData[i].run(); | |
| } | |
| } | |
| private static final class Process { | |
| private static final Composition COMPOSITION = Composition | |
| .all(PositionInterface.class, VelocityInterface.class) | |
| .build(); | |
| private final World _world; | |
| private final EntityArchetype _archetype; | |
| private final IntBag _entities; | |
| private final InterfaceInlineOptimizedProcessingSystemImpl _system; | |
| private final boolean positionInterfaceDataPresent; | |
| public final FloatBag positionInterfaceData_x; | |
| public final FloatBag positionInterfaceData_y; | |
| private final boolean velocityInterfaceDataPresent; | |
| public final FloatBag velocityInterfaceData_vx; | |
| public final FloatBag velocityInterfaceData_vy; | |
| private Process(World world, EntityArchetype archetype, | |
| InterfaceInlineOptimizedProcessingSystemImpl system) { | |
| this._world = world; | |
| this._archetype = archetype; | |
| this._entities = archetype.getEntities(); | |
| this._system = system; | |
| EntityArchetypeDataImpl _data = archetype.getData(); | |
| this.positionInterfaceData_x = _data.positionInterfaceData_x; | |
| this.positionInterfaceData_y = _data.positionInterfaceData_y; | |
| this.positionInterfaceDataPresent = archetype.getComponents().contains(PositionInterface.class); | |
| this.velocityInterfaceData_vx = _data.velocityInterfaceData_vx; | |
| this.velocityInterfaceData_vy = _data.velocityInterfaceData_vy; | |
| this.velocityInterfaceDataPresent = archetype.getComponents().contains(VelocityInterface.class); | |
| } | |
| private final void run() { | |
| /* | |
| pos.x(pos.x() + velocity.vx()); | |
| pos.y(pos.y() + velocity.vy()); | |
| */ | |
| /* | |
| positionInterfaceData_x[_i] += velocityInterfaceData_vx[_i]; | |
| positionInterfaceData_y[_i] += velocityInterfaceData_vy[_i]; | |
| */ | |
| // Return early if no entities | |
| int _s = this._archetype.getAlive(); | |
| if (_s == 0) { | |
| return; | |
| } | |
| float[] positionInterfaceData_x = this.positionInterfaceData_x.getData(); | |
| float[] positionInterfaceData_y = this.positionInterfaceData_y.getData(); | |
| float[] velocityInterfaceData_vx = this.velocityInterfaceData_vx.getData(); | |
| float[] velocityInterfaceData_vy = this.velocityInterfaceData_vy.getData(); | |
| int[] _data = this._entities.getData(); | |
| // Iterate entities | |
| for (int _i = 0; _i < _s; _i++) { | |
| positionInterfaceData_x[_i] += velocityInterfaceData_vx[_i]; | |
| positionInterfaceData_y[_i] += velocityInterfaceData_vy[_i];} | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class InterfaceInlineProcessingSystemImpl extends EntityProcessorBenchmark.InterfaceInlineProcessingSystem implements SystemType { | |
| private final InternalWorld _world; | |
| private final Bag<Process> process; | |
| public InterfaceInlineProcessingSystemImpl(InternalWorld world) { | |
| this._world = world; | |
| this.process = new Bag<>(Process.class, 4); | |
| } | |
| @Override | |
| public final void offerArchetype(EntityArchetype archetype) { | |
| if (Process.COMPOSITION.matches(archetype)) { | |
| this.process.add(new Process(this._world, archetype, this)); | |
| } | |
| } | |
| @Override | |
| public final void runSystem() { | |
| // process(de.schosin.decs.benchmark.components.decs.PositionInterface, de.schosin.decs.benchmark.components.decs.VelocityInterface) | |
| Process[] processData = this.process.getData(); | |
| for (int i = 0, s = this.process.size(); i<s; i++) { | |
| processData[i].run(); | |
| } | |
| } | |
| private static final class Process { | |
| private static final Composition COMPOSITION = Composition | |
| .all(PositionInterface.class, VelocityInterface.class) | |
| .build(); | |
| private final World _world; | |
| private final EntityArchetype _archetype; | |
| private final IntBag _entities; | |
| private final InterfaceInlineProcessingSystemImpl _system; | |
| private final boolean positionInterfaceDataPresent; | |
| public final FloatBag positionInterfaceData_x; | |
| public final FloatBag positionInterfaceData_y; | |
| private final boolean velocityInterfaceDataPresent; | |
| public final FloatBag velocityInterfaceData_vx; | |
| public final FloatBag velocityInterfaceData_vy; | |
| private Process(World world, EntityArchetype archetype, | |
| InterfaceInlineProcessingSystemImpl system) { | |
| this._world = world; | |
| this._archetype = archetype; | |
| this._entities = archetype.getEntities(); | |
| this._system = system; | |
| EntityArchetypeDataImpl _data = archetype.getData(); | |
| this.positionInterfaceData_x = _data.positionInterfaceData_x; | |
| this.positionInterfaceData_y = _data.positionInterfaceData_y; | |
| this.positionInterfaceDataPresent = archetype.getComponents().contains(PositionInterface.class); | |
| this.velocityInterfaceData_vx = _data.velocityInterfaceData_vx; | |
| this.velocityInterfaceData_vy = _data.velocityInterfaceData_vy; | |
| this.velocityInterfaceDataPresent = archetype.getComponents().contains(VelocityInterface.class); | |
| } | |
| private final void run() { | |
| /* | |
| pos.x(pos.x() + velocity.vx()); | |
| pos.y(pos.y() + velocity.vy()); | |
| */ | |
| /* | |
| positionInterfaceData_x[_i] = positionInterfaceData_x[_i] + velocityInterfaceData_vx[_i]; | |
| positionInterfaceData_y[_i] = positionInterfaceData_y[_i] + velocityInterfaceData_vy[_i]; | |
| */ | |
| // Return early if no entities | |
| int _s = this._archetype.getAlive(); | |
| if (_s == 0) { | |
| return; | |
| } | |
| float[] positionInterfaceData_x = this.positionInterfaceData_x.getData(); | |
| float[] positionInterfaceData_y = this.positionInterfaceData_y.getData(); | |
| float[] velocityInterfaceData_vx = this.velocityInterfaceData_vx.getData(); | |
| float[] velocityInterfaceData_vy = this.velocityInterfaceData_vy.getData(); | |
| int[] _data = this._entities.getData(); | |
| // Iterate entities | |
| for (int _i = 0; _i < _s; _i++) { | |
| positionInterfaceData_x[_i] = positionInterfaceData_x[_i] + velocityInterfaceData_vx[_i]; | |
| positionInterfaceData_y[_i] = positionInterfaceData_y[_i] + velocityInterfaceData_vy[_i];} | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class InterfaceProcessingSystemImpl extends EntityProcessorBenchmark.InterfaceProcessingSystem implements SystemType { | |
| private final InternalWorld _world; | |
| private final Bag<Process> process; | |
| public InterfaceProcessingSystemImpl(InternalWorld world) { | |
| this._world = world; | |
| this.process = new Bag<>(Process.class, 4); | |
| } | |
| @Override | |
| public final void offerArchetype(EntityArchetype archetype) { | |
| if (Process.COMPOSITION.matches(archetype)) { | |
| this.process.add(new Process(this._world, archetype, this)); | |
| } | |
| } | |
| @Override | |
| public final void runSystem() { | |
| // process(de.schosin.decs.benchmark.components.decs.PositionInterface, de.schosin.decs.benchmark.components.decs.VelocityInterface) | |
| Process[] processData = this.process.getData(); | |
| for (int i = 0, s = this.process.size(); i<s; i++) { | |
| processData[i].run(); | |
| } | |
| } | |
| private static final class Process { | |
| private static final Composition COMPOSITION = Composition | |
| .all(PositionInterface.class, VelocityInterface.class) | |
| .build(); | |
| private final World _world; | |
| private final EntityArchetype _archetype; | |
| private final IntBag _entities; | |
| private final InterfaceProcessingSystemImpl _system; | |
| private final PositionInterfaceImpl positionInterfaceData; | |
| private final boolean positionInterfaceDataPresent; | |
| private final VelocityInterfaceImpl velocityInterfaceData; | |
| private final boolean velocityInterfaceDataPresent; | |
| private Process(World world, EntityArchetype archetype, | |
| InterfaceProcessingSystemImpl system) { | |
| this._world = world; | |
| this._archetype = archetype; | |
| this._entities = archetype.getEntities(); | |
| this._system = system; | |
| EntityArchetypeDataImpl _data = archetype.getData(); | |
| this.positionInterfaceData = new PositionInterfaceImpl(archetype.getData()); | |
| this.positionInterfaceDataPresent = archetype.getComponents().contains(PositionInterface.class); | |
| this.velocityInterfaceData = new VelocityInterfaceImpl(archetype.getData()); | |
| this.velocityInterfaceDataPresent = archetype.getComponents().contains(VelocityInterface.class); | |
| } | |
| private final void run() { | |
| // Return early if no entities | |
| int _s = this._archetype.getAlive(); | |
| if (_s == 0) { | |
| return; | |
| } | |
| int[] _data = this._entities.getData(); | |
| // Iterate entities | |
| for (int _i = 0; _i < _s; _i++) { | |
| this.positionInterfaceData.index = _i; | |
| this.velocityInterfaceData.index = _i; | |
| this._system.process(this.positionInterfaceData, this.velocityInterfaceData); | |
| } | |
| this.positionInterfaceData.index = -1; | |
| this.velocityInterfaceData.index = -1; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Generated( | |
| value = "de.schosin.decs.codegen.DecsAnnotationProcessor", | |
| date = "2025-10-19T19:09:54.792634100Z" | |
| ) | |
| public final class PositionInterfaceImpl implements PositionInterface, Pooled { | |
| public int index; | |
| public final FloatBag positionInterfaceData_x; | |
| public final FloatBag positionInterfaceData_y; | |
| public PositionInterfaceImpl(EntityArchetypeDataImpl data) { | |
| this.index = -1; | |
| this.positionInterfaceData_x = data.positionInterfaceData_x; | |
| this.positionInterfaceData_y = data.positionInterfaceData_y; | |
| } | |
| @Override | |
| public final float x() { | |
| return this.positionInterfaceData_x.getUnsafe(index); | |
| } | |
| @Override | |
| public final void x(float value) { | |
| this.positionInterfaceData_x.setUnsafe(index, value); | |
| } | |
| @Override | |
| public final float y() { | |
| return this.positionInterfaceData_y.getUnsafe(index); | |
| } | |
| @Override | |
| public final void y(float value) { | |
| this.positionInterfaceData_y.setUnsafe(index, value); | |
| } | |
| @Override | |
| public final void reset() { | |
| this.index = -1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment