zinc-dual-index-pattern

Implement dual-index pattern for global and group views in War3Lib.

11|3|Updated Oct 17, 2024
One-click install
npx skills add https://github.com/Crainax/War3Lib --skill zinc-dual-index-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zinc-dual-index-pattern
Source: https://github.com/Crainax/War3Lib/tree/main/.codex/skills/zinc-dual-index-pattern
Command: npx skills add https://github.com/Crainax/War3Lib --skill zinc-dual-index-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Efficiently manage dynamic collections that must be visible in both a global order and per-group views, while keeping storage compact and enabling fast updates in War3Lib.

Core Features & Use Cases

  • Dual-view indexing: global and grouped lists maintain synchronized positions for each element.
  • O(1) deletion: remove elements by swapping with the last item and shrinking the array.
  • Compact storage: contiguous memory layout with no holes, enabling fast iteration for buffs, effects, queues, and timers.
  • Use cases: high-frequency create/destroy workloads where quick iteration and predictable memory usage matter.

Quick Start

Implement a dual-index pattern in your War3Lib project by initializing a global list and per-group lists to start managing elements immediately.

Frequently Asked Questions about zinc-dual-index-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage dynamic collections with both global and per-group views in War3Lib?

A dual-index pattern solves this by maintaining synchronized positions for each element across global and grouped lists. This ensures consistent cross-view indices while keeping storage contiguous for fast iteration in War3Lib.

How do I achieve O(1) deletion for buffs and effects in Lua-JASS?

You can achieve O(1) deletion in Lua-JASS by using a swap-remove technique. This removes elements by swapping the target with the last array item and shrinking the array, avoiding costly memory shifts.

What is the best way to prevent memory fragmentation when frequently creating and destroying timers?

To prevent memory fragmentation when frequently creating and destroying timers, use compact storage with contiguous arrays. This layout eliminates memory holes and maintains predictable memory usage for high-frequency workloads.

Can I use a dual-index pattern for high-frequency create/destroy workloads in War3Lib?

Yes, the dual-index pattern is designed for high-frequency create/destroy workloads in War3Lib. It supports scenarios like buffs, effects, and central timers where quick iteration and predictable memory usage are essential.

How do I implement a compact array structure for synchronized lists?

To implement a compact array structure for synchronized lists, initialize a global list and per-group lists. This dual-view indexing maintains contiguous memory with no holes while keeping parallel structures synchronized for each element.