a library for dayz performance improvments
C++ Perl C
Switch branches/tags
Nothing to show
Pull request Compare This branch is 19 commits ahead of SuperTuck:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A performance library (.dll) for bliss (dayz server), small and easy to use.

So why does it make sense to optimize our server script code?

Here we are mainly talking about so-called eventhandlers (EH's).
EH's are scripted procedures/functions, which are called on demand. For example, an EH can be executed if the value of a public variable or a object state changes. EH are currently running in a single thread.
This means there is only one running EH at the same time, or the scheduler runs the EH in the much slower scheduled environment. So if one slow running EH is executed, all other events are affected. There is a critical point, where the execution of the EH's is noticeable slowed down. You have to experience it currently on many full dayz servers (loading screen issue).

To have a fast responding server, it is important, that we write our EH code with highest possible efficiency.

Now lets explain what blissperflib.dll can do for us and how it is to use.

Essential part of this library is the included profiler. It is a tool to measure the execution time from a piece of code and is very helpfull for developers. This profiler can collect call statistics for code segments and logs all statistic data to a logfile. All this works in realtime and because logging works asynchron (in separat thread), the profiler has nearly no impact to overall performance. Just lets run your prepared server with high load for a few hours and then evaluate blissperflib.log. So you can easily spot the bottlenecks and then start investigating the related code or report your results to other developers.

In some cases it is useful or nessecary to replace script code by much faster c code.
This library supports you in this case too, by providing an easy to use interface template.

With the help of our profiler we can easily spot a perfect example of a bottleneck:
The function fnc_split in the current bliss implementation. Read more about that later under: fnc_split

How to use details and links:


Compile blissperflib.dll from source /src or get the library binary (.dll) from here:


Copy blissperflib.dll to your Arma 2 directory.

Further steps depends on your intention, read below.

To use only the Profiler:
To profile a script (or piece of code), just insert the following lines at begin and end:

_PCID99 = "blissperflib" callExtension "0:99";
"blissperflib" callExtension format ["1:%1",_PCID99];

Where all '99' here represents a unique ID and must be replaced with a integer in range 10..99
(Make sure that in all .sqf functions, the return variable always remains the last line!!!)

To show real names in the log, there must be valid entrys in blissperflib.ini
example of blissperflib.ini:

18 = server_hiveReadWrite
19 = server_hiveWrite
20 = server_onPlayerConnect

If we are ready with profiling work and want stop profiling, we currently have to restore the original files from repository or our backup.

To save you some work and as start example, i added the perl script prepprof.pl. This script inserts the profiler command lines in your .sqf scripts and generates the blissperflib.ini file automatically.
Run this script from your repository directory and copy the generated blissperflib.ini to your Arma 2 directory. Run build.pl and deploy as usual. Please run this script only once, to avoid double profiler command insertion.

The profiler logging output goes to Arma2Dir\blissperflib.log and a line looks like that:

12:23:59 NL: 1 TC: 37 AD: 6.070ms 21.140ms : fnc_split

NL: current nesting level (only investigated code counts)
TC: total count of this function/codesegment since server start
AD: average duration of this function/codesegment
CD: current duration of this function/codesegment
and last the name of this function/codesegment

fnc_split: (the first black sheep found)
fnc_split is the first function replacement, implemented in this library (blissperflib.dll).

It runs more then 300 times faster!!! than the related .sqf code.
If you dont have the fastest server and you have many players, such optimization is noticeable for you and your players.

If you only want to use the fnc_split function replacement, just do the following:
Replace the file Repository\pkg\bliss\compile\fnc_split.sqf with the file from here:


Install blissperflib.dll, rebuild and redeploy your dayz_server.pbo as usually.

Just to clarify, it is NOT NESSECARY to prepare the profiler, if you only want to use the optimized function('s) from the library.
All you then need, is the installed blissperflib.dll and the related .sqf replacement, fnc_split.sqf for example.

That's all for now. Let me know, if you have ideas for improvements.

ENJOY THE DIFFERENCE and sorry for my english :P

Special thanks to ayan4m1 and the bliss team, for the great bliss development: