Performance of Choob

Note that bucko made these stats using JProfiler (so divide most stuff by 6-7) on his heavily loaded and underclocked Athlon XP 1800+.

API calls

Setting up a simple loop calling an API function 1000 times spent 1020ms inside the commandWhoreAPI routine, 420ms of which was inside the actual apiWhore routine. This means the overhead for calling an API call is something like 0.6ms. If the call does exist, the overhead is more like 0.4ms. If the plugin doesn't exist, it's even smaller - just 0.2ms.

This means we shouldn't be too afraid of speed issues involved with calling API stuff to implement features executed once per line: ChoobDecoderTask? itself: We already use 7-8ms just to add the line to the log.

(Of course, these are JProfiler times, but you get the picture.)

For reference, the big chunks of CPU overhead for an API call are something like:

0.2ms (getPluginContext()) 0.2ms (getAPISignature())

Without JProfiler, 100,000 calls took 10s, so expected overhead is about 0.1ms.

Commands

Calling a command 1000 times using pluginModule.callCommand spent 6299ms. Of this, ~6000ms were used in security checks (NB: From the bot core, this is negligible; also, ~3600ms was used by SQL queries which shouldn't have been called; investigating).

On the whole, one can expect an overhead of perhaps 0.4ms internally and 4ms externally for command calling once I get the cache fixed.

Without JProfiler, 1,000 external calls took ~7s.

With the SQL fix, 10,000 external calls took ~6s, with 2 rejected executions.

So without JProfiler, I expect 0.05ms (if that) internally and 0.6ms externally.

Generics

Since these use basically the same mechanism as API, but with a security check, assume about 4ms externally and about 0.7ms internally.

Without JProfiler, I expect about 0.7ms external and 0.1ms internally.

ObjectDB

Not done with JProfiler, I'm afraid.

Saving an object takes about 1ms plus about 0.6ms for every field. Deleting an object takes about 4ms regardless. Fetching objects takes about 0.1ms plus 0.03ms per field, if you do them in bulk. Individually, it's about 3-4ms.

Setting up a transaction object takes about 4-5ms. Ie, every individual mods.odb.* call pays this, but you only pay it once for runTransaction.

ObjectDB is the big whorepoint in Choob right now -- still. Need to JProfiler it a bit more; looks like there's bits other than retrieving that can whore.