From #irowiki, around 2010:
[01:19:10] <pfak> Little tweaks here and there would improve things tenfold.
[01:19:30] <pfak> Me getting Aegis down to using basically no CPU and RAM was modifying a few functions, and very LITTLE in the functions
[01:19:34] <pfak> They have the source
[01:19:36] <pfak> I didnt
[01:19:57] <Doddler> I'm curious, what specific functions are bogging it down?
[01:20:50] <pfak> GetServerRandom(), CCharacterMgr::ProcessAllCharacter()
[01:20:58] <pfak> For CPU usage
[01:21:04] <pfak> and lag
[01:21:14] <Doddler> haha, ok maybe not specifically, I guess it was just what it is that they're doing that is screwing it up
[01:21:32] <pfak> CAsyncStream::CAsyncStream() for RAM
[01:21:38] <pfak> They allocate a 10MB buffer for every player
[01:21:59] <Doddler> hah, 10Mb? No wonder...
[01:23:27] <pfak> GetServerRandom is used in pratically every single skill, and in the core loop of the program. The problem is it uses QueryPerformanceCounter on every call.
[01:23:42] <pfak> QueryPerformanceCounter is VERY resource intensive, especially when its being called 10,000 times a second.
[01:23:59] <pfak> And to make matters worse, they use getserverarndom to see if they should execute calls which uses more CPU than actually just executing the calls
[01:24:20] <pfak> And, over time, GetServerRAndom is called more and more because more and more mobs get activated (by someone walking past) and they never get deactivated.
[01:24:45] <pfak> So I replaced GetServerRandom with a highly optimized PRNG implementation.
[01:25:02] <pfak> Which, is not only more random but uses about 0.1% of the CPU that the original call does.
[01:25:40] <Doddler> I guess they've never heard of a profiler have they
[01:25:47] <pfak> and processallcharacter handles mobs, players, npcs, etc. the problem is they dont ever sleep NPC AI. So I just made it so that NPC AI runs every 50ms which removed the CPU lag and actually made monsters more responsive
If what he said is still true, then the lag can likely be fixed, but that can only be done by HQ.
iRO can't do much more than redistributing or reducing the load.
Edited by renouille, 15 June 2014 - 08:56 PM.