You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 23:16:19 +00:00
5319e5e5c3
1. HabboManager - O(1) username lookup Before: getHabbo(String) held a synchronized lock and iterated ALL online users every call After: Secondary ConcurrentHashMap<String, Habbo> keyed by lowercase username → instant get() lookup, no lock contention 2. ItemsComponent - Batch DB saves Before: dispose() spawned a separate thread per dirty item, each opening its own DB connection After: Single connection, JDBC addBatch()/executeBatch() for both UPDATE and DELETE, flushed every 100 items. A user with 500 dirty items now does 5 batch executions instead of 500 thread spawns + 500 connections. 3. AcceptFriendRequestEvent - N+1 elimination Before: For each offline user: query 1 (getOfflineHabboInfo by ID) → query 2 (load full Habbo by username) = 2 queries × up to 100 users = 200 queries After: Single query by user ID directly = 1 query × up to 100 users = 100 queries (50% reduction) 4. RoomManager - Direct HashMap lookup Before: getCategory(int id) iterated all categories checking getId() == id even though the map is already keyed by ID After: Direct roomCategories.get(id) → O(1) instead of O(n)