Issue information

Issue ID
#2256
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 23, 2008 13:15
Last Post
Hercules Elf Bot
Apr 19, 2012 15:41
Confirmation
N/A

Hercules Elf Bot - Sep 23, 2008 13:15

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=2256

After testing my [url="http://www.eathena.ws/board/index.php?showtopic=198741"]performance monitoring[/url] code on an empty testserver, it became apparent that there are some very inefficient parts of the code. These should be optimized to reduce server lag.

With dynamic mobs turned off
[code][Debug]: processed timer mob_ai_lazy... in 9 ms
[Debug]: processed timer status_natural_heal_timer... in 8 ms
[/code]

The first activates once per second and is caused by lazy AI processing. That's mobs that don't have any players nearby. On a server with no players, this constitutes to around 10000 mobs. All of them have nonzero spawn time and thus are being skipped by the dynamic mobs code. Many of them are plants, which don't have any AI actions to process. Also these mobs are probably on rarely-visited maps, so there's no point to having them around. To try and eliminate this overhead, see [url="http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=1197"]#1197[/url].

The second activates twice per second and is caused by hp/sp regen processing. Here the fault lies in the fact that even though only players and homunculi (and mercenaries) are able to regen, the code processes all entries in the [i]id_db[/i] - and that also counts the 50000 npc objects inside. One possibility is to track all relevant objects in a separate regen_db and process only that. FlavioJS suggested a regen timer heap (no idea how that works) to replace the "process everything every 500ms" timer.

This post has been edited by Brian on Jan 18, 2012 19:54

Hercules Elf Bot - Jan 17, 2012 20:10

Originally posted by [b]Gepard[/b]
This actually has been already improved, so I mark it as fixed.

[quote][font=Arial, Verdana, Tahoma,]More mobs unloaded, by [/font][url="http://svn.eathena.ws/bugs/changeset/13445/"]r13445[/url][font=Arial, Verdana, Tahoma,].[/font]
[font=Arial, Verdana, Tahoma,]Regen timers process more efficiently, by [/font][url="http://svn.eathena.ws/bugs/changeset/13443/"]r13443[/url][font=Arial, Verdana, Tahoma,].[/font][/quote]