ZZ / Godot JSON-LD Graph Viewer
Dernière activité
| 1 | extends Node2D |
| 2 | |
| 3 | const GRAPH_FILE_PATH = "res://network_graph3.json" |
| 4 | var graph_node_scene: PackedScene = preload("res://GraphNode.tscn") |
| 5 | #@onready var status_label: Label = $ColorRect/Label |
| 6 | @onready var status_label: RichTextLabel = $ColorRect/Label |
| 7 | var _stable_frames: int = 0 |
| 8 | |
| 9 | # ========================================== |
| 10 | # PHYSICS TUNING & MOBILE OPTIMIZATIONS |
ZZ / Gemma4-C++-to-Rust-Triple-Buffer-Test.md
Dernière activité
This is a lock-free Triple Buffer implementation. Its primary purpose is to allow one thread (the Producer) to write data and another thread (the Consumer) to read data without blocking each other, while ensuring the consumer always gets the most recent "complete" frame.
Here is the translation into Rust.
The Rust Implementation
To implement this in Rust, we need UnsafeCell because we are mutating elements of an array across different threads based on a manual state machine rather than using a Mutex. We also use repr(align(64)) to match the C++ alignas(64), which prevents "false sharing" (where the CPU caches multiple buffers in one line, causing performance degradation).
use std::cell::UnsafeCell;