Skip to content

Reduce redundant scripted vehicle and block entity work - #53

Open
frankniubi wants to merge 2 commits into
DistrictOfJoban:v2.2from
frankniubi:perf/reuse-vehicle-render-data
Open

Reduce redundant scripted vehicle and block entity work#53
frankniubi wants to merge 2 commits into
DistrictOfJoban:v2.2from
frankniubi:perf/reuse-vehicle-render-data

Conversation

@frankniubi

Copy link
Copy Markdown

Summary

  • Reuse raw full-train car and bogie positions during one RenderVehicles.render invocation through a chainable MixinExtras @WrapOperation with try/finally cleanup.
  • Read immutable vehicle IDs directly for model-part metadata instead of calculating train positions.
  • Skip six neighbor redstone-power checks when a Sound Looper does not require redstone.

Motivation

Scripted vehicle callbacks can request the same full-train position data repeatedly, with the cost growing with train length. The invocation-scoped, identity-keyed single-entry cache lets adjacent callbacks for one vehicle reuse that calculation while preserving raw, unsmoothed position semantics. The remaining changes remove calculations whose results are not used.

The cache is owned by the rendering thread, bypassed by non-owner threads, strongly retained only for the wrapped invocation, and cleared on both normal and exceptional exits. @WrapOperation delegates through the original invocation and remains chainable with other wrappers.

Verification

  • Fabric 1.20.1 Gradle build passed.
  • Covered shared-source setup, compilation, shadowing, source artifacts, remapping, and packaging.
  • Inspected compiled bytecode to confirm the wrapper descriptor, target invocation, and exception cleanup path.
  • There are no JCM test sources for this path.
  • No runtime FPS or TPS benchmark is claimed by this pull request.

🤖 Generated with Claude Code

frankniubi and others added 2 commits July 22, 2026 19:56
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant