Repository navigation
cache currentTimeMillis - #344
Conversation
WalkthroughThe change adds a shared timestamp updated at each client tick and uses it for forced-visibility timeouts. Entity and block-entity render paths now check culling before forced visibility. ChangesVisibility and culling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The reviewed changes have no demonstrated user-facing regression in the inspected render and paused-client paths. The repository does not enforce the optional Sonar warning, so no known issue blocks merging. Pre-merge checks |
|
|
There was a problem hiding this comment.
🔇 Additional comments (5)
src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java (1)
39-39: LGTM!src/main/java/dev/tr7zw/entityculling/mixin/CullableMixin.java (1)
8-8: LGTM!Also applies to: 35-35, 40-40
src/main/java/dev/tr7zw/entityculling/mixin/WorldRendererMixin.java (1)
54-54: LGTM!Also applies to: 161-161
src/main/java/dev/tr7zw/entityculling/mixin/BlockEntityRenderDispatcherMixin.java (1)
77-77: LGTM!Also applies to: 116-116
src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.java-81-81 (1)
81-81: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Move the static write into a static helper.
The SonarCloud diagnostic flags this assignment.
clientTick()uses instance state, so it cannot be static. Move the assignment into a static helper and call that helper here.Proposed change
public void clientTick() { - tickTimeMs = System.currentTimeMillis(); + updateTickTime();Add a static helper:
private static void updateTickTime() { tickTimeMs = System.currentTimeMillis(); }Source: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cf4ef110-9b0a-4efc-9a06-8327ee602d48
📒 Files selected for processing (4)
src/main/java/dev/tr7zw/entityculling/EntityCullingModBase.javasrc/main/java/dev/tr7zw/entityculling/mixin/BlockEntityRenderDispatcherMixin.javasrc/main/java/dev/tr7zw/entityculling/mixin/CullableMixin.javasrc/main/java/dev/tr7zw/entityculling/mixin/WorldRendererMixin.java
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.




On macOS (idk if this is the same elsewhere), running
System.currentTimeMillistakes on average 14.7 ns compared to a normal field read (~0.3 ns). With 2,000 culled entities running at 500fps this would be ~1.5% of frame time.This PR moves the check to run after
cullable.isCulledand cachescurrentTimeMillisso that this method call has little to no effect on frame time.