Skip to content

Performance & Memory Impact

Overview

Stack Size Adjuster is designed for maximum efficiency, zero memory overhead, and zero NBT bloat.


⚡ Key Performance Optimizations

  1. Primitive Value Storage: Active limits are stored in volatile int primitive fields within StackSizeManager, ensuring $O(1)$ lock-free read access during stack size calculations.
  2. Zero NBT Inflation: Unlike custom item mods that inject custom NBT tags to track stack sizes, Stack Size Adjuster hooks directly into vanilla component data (DataComponents.MAX_STACK_SIZE) and ExtraCodecs.intRange(1, Integer.MAX_VALUE). Saved world sizes remain 100% identical to vanilla.
  3. No Tick Listeners: The mod executes zero logic in tick loops (EndTick, WorldTick). Code is executed purely on-demand during item queries, command invocations, or container drops.
  4. Fast Thread-Safe Overrides: External addon overrides are maintained in a CopyOnWriteArrayList<BiFunction<Item, Integer, Integer>>, providing thread-safe lock-free iteration.

📊 Memory & CPU Footprint Benchmarks

MetricMeasured ImpactOptimization Mechanism
Heap Memory Allocation$< 50\text{ KB}$Zero transient object creation during stack checks
World Save Data Footprint$+0\text{ Bytes}$Primitive component codec modification
Server Tick Overhead (MSPT)$0.00\text{ ms}$Lock-free primitive reads; zero tick loops
Container Breaking MSPT$< 0.50\text{ ms}$InventoryDropHelper entity spawn cap

Official documentation & web portal for Dasik Igaijinn mods.