Performance Optimization Tips for Azeroth Auction Assassin (AAA): A Technical Deep Dive
Azeroth Auction Assassin achieves high-throughput auction sniping through configurable ThreadPoolExecutor concurrency, O(1) alert deduplication via Set data structures, and time-windowed scanning that respects Blizzard's rate limits.
The ff14-advanced-market-search/azerothauctionassassin repository is a high-performance Blizzard Auction House sniping tool designed to process massive datasets across multiple realms while staying within API constraints. Understanding the performance optimization tips for AAA reveals how the codebase leverages Python's concurrency primitives, constant-time data structures, and strategic caching to minimize latency and maximize scan throughput.
Core Concurrency Architecture
Configurable ThreadPoolExecutor for Parallel Realm Scanning
AAA parallelizes API calls across hundreds of realms using a configurable ThreadPoolExecutor. In mega_alerts.py at line 781, the scanner initializes a pool with max_workers=mega_data.THREADS (defaulting to 48) to fetch each realm's data concurrently. This prevents sequential network latency from bottlenecking the entire scan cycle.
The thread count is not hardcoded. In utils/mega_data_setup.py at lines 85-94, the MegaData class parses MEGA_THREADS from mega_data.json, environment variables, or falls back to 48. This allows power users to tune CPU and memory usage based on their hardware capabilities.
O(1) Lookup Patterns for Alert Deduplication
To prevent duplicate notifications without slowing down the hot path, AAA employs constant-time data structures. The Python backend and Node UI both use Set objects for alert_record storage. In node-ui/mega-alerts.js at line 1436, membership tests against this Set provide O(1) duplicate detection, ensuring that alert storms do not degrade performance as the session grows.
Similarly, target price validation uses lookup maps instead of linear scans. At line 2134 in node-ui/mega-alerts.js, the UI constructs a plain object (priceMap) where keys are item IDs and values are target prices. This enables instantaneous price comparisons during high-frequency auction updates.
Time-Based and Resource Optimization
Scan Window Logic to Reduce Idle Cycles
AAA avoids wasting CPU cycles and API calls by restricting scans to specific minutes within the hour. The is_in_scan_window function in mega_alerts.py (lines 24-48) computes a dynamic start and end minute based on SCAN_TIME_MIN and SCAN_TIME_MAX configuration values. By wrapping around the 60-minute boundary, this logic ensures the scanner only activates when new auction data is expected, cutting unnecessary network traffic by up to 80% during off-minutes.
Static Data Caching and Rate Limit Compliance
To respect Blizzard's rate limits while maintaining responsiveness, AAA aggressively caches static metadata. In utils/mega_data_setup.py at lines 99-106, the MegaData constructor fetches pet and item names once (self.PET_NAMES = get_petnames(self.access_token)) and stores them in instance variables. This eliminates redundant HTTP calls for reference data that rarely changes.
The main loop further protects API quotas by implementing intelligent backoff. After processing a full batch of realms, the scanner sleeps for 5 seconds, and when waiting for the next upload window, it extends this to 20 seconds. These hardcoded intervals in mega_alerts.py prevent 429 errors while keeping latency acceptable.
Configuration-Driven Performance Tuning
AAA exposes several boolean flags that allow users to disable heavy computational paths when they are not needed. In utils/mega_data_setup.py at lines 24-42, the __set_mega_vars method parses REFRESH_ALERTS, EXTRA_ALERTS, DEBUG, and NO_LINKS from the configuration file. When these are set to false, the application skips entire branches of logic—such as re-fetching historical data or generating Discord embed links—dramatically reducing CPU and memory pressure during high-volume scans.
Practical Code Examples
Configurable Thread Pool Execution
# mega_alerts.py – Parallel realm data fetching
from concurrent.futures import ThreadPoolExecutor
# mega_data.THREADS defaults to 48, configurable via mega_data.json
pool = ThreadPoolExecutor(max_workers=mega_data.THREADS)
for connected_id in matching_realms:
pool.submit(pull_single_realm_data, connected_id)
pool.shutdown(wait=True)
Constant-Time Alert Deduplication
// node-ui/mega-alerts.js – Preventing duplicate notifications
const alert_record = new Set(); // O(1) membership testing
function processAlert(alertKey) {
if (alert_record.has(alertKey)) {
return; // Skip duplicate
}
alert_record.add(alertKey);
// Send notification...
}
Fast Target Price Validation
// node-ui/mega-alerts.js – Building lookup maps
const priceMap = {};
for (const item of desiredItems) {
priceMap[item.id] = item.targetPrice; // O(1) access later
}
// Usage during scan
if (currentPrice <= priceMap[itemId]) {
triggerAlert();
}
Scan Window Calculation
# mega_alerts.py – Time-based execution gating
def is_in_scan_window(current_min, last_upload_min, scan_time_min, scan_time_max):
start_min = (last_upload_min + scan_time_min) % 60
end_min = (last_upload_min + scan_time_max) % 60
if start_min <= end_min:
return start_min <= current_min <= end_min
return current_min >= start_min or current_min <= end_min
Key Files for Performance Optimization
| File | Performance Role |
|---|---|
utils/mega_data_setup.py |
Centralizes configuration parsing for MEGA_THREADS, SCAN_TIME_MIN/MAX, and feature flags like DEBUG and REFRESH_ALERTS. |
mega_alerts.py |
Contains the ThreadPoolExecutor implementation, scan window logic (is_in_scan_window), and main loop backoff strategies. |
node-ui/mega-alerts.js |
Implements O(1) alert deduplication using Set and fast price lookups via object maps. |
AzerothAuctionAssassin.py |
UI layer exposing thread count and debug mode controls to end users. |
utils/realm_data.py |
Provides static realm ID mappings to minimize API discovery calls. |
Summary
- Configurable concurrency via
ThreadPoolExecutor(default 48 threads) allows AAA to parallelize realm scans without hardcoding resource limits. - O(1) data structures (
Setfor alert deduplication, object maps for price lookups) eliminate linear scans during high-frequency auction updates. - Time-windowed scanning restricts API calls to specific minutes around the Blizzard upload window, reducing idle CPU cycles and respecting rate limits.
- Static data caching for pet and item names prevents redundant HTTP requests, while configurable boolean flags allow users to disable heavy features like
EXTRA_ALERTSorREFRESH_ALERTSto conserve resources.
Frequently Asked Questions
How do I increase the scan speed in Azeroth Auction Assassin?
Increase the MEGA_THREADS value in your AzerothAuctionAssassinData/mega_data.json file or set the MEGA_THREADS environment variable. The default is 48, but you can raise it to 96 or higher depending on your CPU cores and network bandwidth, as validated in utils/mega_data_setup.py lines 85-94.
What is the scan window feature and how does it improve performance?
The scan window restricts auction scans to specific minutes within the hour when Blizzard actually uploads new data. By setting SCAN_TIME_MIN and SCAN_TIME_MAX in your configuration, the is_in_scan_window function (mega_alerts.py lines 24-48) skips unnecessary scans during off-minutes, reducing API calls and CPU usage by up to 80%.
How does AAA prevent duplicate alerts without slowing down?
AAA uses a Set data structure for alert_record storage, providing O(1) membership testing. In node-ui/mega-alerts.js at line 1436, the code checks if (alert_record.has(alertKey)) before processing, ensuring constant-time deduplication regardless of how many alerts have been sent during the session.
Can I disable heavy features to improve performance on low-end hardware?
Yes. Set REFRESH_ALERTS, EXTRA_ALERTS, and DEBUG to false in mega_data.json. These boolean flags are parsed in utils/mega_data_setup.py lines 24-42, and when disabled, they skip entire code paths—such as re-fetching historical data or generating Discord embeds—significantly reducing memory and CPU pressure.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →