Archive for June, 2007

Benchmarks Against EventScripts

Thursday, June 7th, 2007

A long time ago we wrote benchmark charts comparing AMX Mod and AMX Mod X. It created a flurry of flaming, but the end result was — AMX Mod X performed better, but the comparisons were realistic.

Today we’re releasing: benchmarks against EventScripts. Needless to say, these comparisons have an astronomical difference, totally unlike the AMX Mod charts. Although we’re expecting a lot of flaming — Enjoy!

Benchmarks Against AMX Mod X

Wednesday, June 6th, 2007

After all this talk about optimizing SourceMod, has it paid off? Today I’ve updated our old AMX Mod X benchmark tests for SourceMod and added a few new tests.

The old test suite is available here.
Updated files for SourceMod support are here.

First, let’s show a pretty graph of the results (click to enlarge):

To keep things short, here’s a quick rundown of what’s faster and why:

  • Integer – We’ll chalk this one up to the opcode improvements of the JIT. Especially integer division got a big improvement, although this test covers the main four functions and modulus.
  • Float – The opcodes generated for float rounding got entirely redone by faluco and ended up much faster.
  • Format() – These are almost identical because SourceMod and AMX Mod X both have the same underlying code for formatting (“atcprintf”).
  • String Fetch – This is designed to test MF_GetAmxString/get_amxstring versus SourceMod’s IPluginContext::LocalToString by using str_to_num and StringToInt. SourceMod’s is obviously faster because there is no cell * to char * copying taking place, as there is with AMX Mod X.
  • Translation – SourceMod has a more efficient translation lookup cache, which uses a trie instead of a hash table.
  • Replace() – SourceMod’s ReplaceStringEx() is probably actually slower than AMX Mod X’s replace(). However, AMX Mod X doesn’t have a native implementation for replacing all occurrences, and SourceMod does. SourceMod’s single-replace function accounts for more cases internally so it can do replacements on buffers which are not long enough.

So, SourceMod is indeed marginally faster or more than AMX Mod X for most of the fundamental operations, which are integer and float math, and string fetching/translation.