Skip to content

🧪 Inventory Diagnostics — Performance Smoke Tests

This folder contains diagnostics-only scripts used to validate how the Inventory system behaves under repeated load.

These are not gameplay systems and are not part of the supported runtime API.


🎯 Purpose

These scripts exist to:

  • Stress public Inventory APIs under repeated usage
  • Surface performance characteristics (timing, allocations)
  • Validate that core behaviour remains stable and predictable

👉 They help answer:

“Does the system still behave correctly when hammered?”


📦 Included

Script Purpose
InventoryPerfSmoke Stresses core inventory operations (add, remove, split, merge, transfer, sort, search)
InventorySnapshotPerfSmoke Stresses snapshot capture and restore (JSON-based workflows)

🚀 How to Use

  1. Create a clean test scene
  2. Add one of the smoke scripts to an empty GameObject
  3. Assign:

  4. ItemDatabase

  5. ItemDefinition
  6. Press Play
  7. Observe:

  8. Console logs

  9. Unity Profiler (CPU / GC Alloc / Timeline)

📊 What These Tests Show

These scripts provide insight into:

  • Execution time for repeated operations
  • Allocation behaviour (GC pressure)
  • Stability under load
  • Scaling behaviour (via container size and iteration count)

⚠️ What These Tests Do NOT Prove

These are smoke tests, not benchmarks.

They do not guarantee:

  • Performance in all projects
  • Performance with custom gameplay logic
  • UI, rendering, or animation cost
  • Networking or persistence overhead

🧠 Interpretation

If these scripts behave cleanly but your project is slow, common causes are:

  • Excessive per-frame inventory operations
  • Large container sizes combined with frequent sorting/searching
  • UI update overhead
  • Custom logic layered on top of the system

🔐 Authority Notes

  • Inventory mutations still go through SceneInventoryService
  • Authority rules (IInventoryAuthority) still apply
  • These scripts run in permissive mode by default

🧩 Design Philosophy

These diagnostics:

  • Use public APIs only
  • Avoid internal shortcuts
  • Mirror real-world usage patterns

If these tests pass:

👉 the core system is behaving correctly


📝 Notes

  • Designed for developer inspection, not end-user features
  • Safe to delete from your project
  • Best used alongside the Unity Profiler

  • Inventory Samples → usage examples
  • Inventory Teachables → guided interaction panels
  • Inventory Runtime → core system implementation