Problem:
My application runs significantly slower when I add EurekaLog to the project.
Reason:
EurekaLog can not slow down your application under normal circumstances - because EurekaLog is not active in your application almost all of the time. The only moments when EurekaLog becames active (and does its work) are:
- The exception is raised. Since EurekaLog does a lot of work for processing exception (collecting info, etc.) - the processing takes time. So, if your code raises a lot of exceptions - then this processing can slow you down. For example, if your code uses exceptions for notifications reasons (not as emergency mechanism as it should be);
- EurekaLog can decrease performance of your memory operations when memory features are enabled;
- EurekaLog can decrease performance of your application if you start/stop threads frequently and low-level hooks are enabled.
- EurekaLog monitors your primary thread when freeze detection feature is enabled;
Therefore a great decrease in application's performance usually means that you abuse exception system - in the sense that your code raising exception very frequently (possible in for/while/repeat-cycle) as its normal execution. Or if you are doing a lot of (small) memory allocations - instead of allocating a large buffer. Or if you are constantly starting threads - instead of using thread pools.
Solution:
If you have this performance problem only for a specific code area and you don't need to use EurekaLog for it. E.g. if you are using something like this:
try
// your code
except
// does nothing
end;
Then the easiest solution would be to disable EurekaLog for that code block:
SetEurekaLogStateInThread(0, False);
try
// your code
finally
SetEurekaLogStateInThread(0, True);
end;
However, if that is not the case - then you need to find out what is causing the performance loss:
- Try to disable memory features first;
- Try to disable freeze detection;
- Check how many exceptions does your code raises. Check if you have "Catch Handled exceptions" option enabled;
- Try to disable low-level hooks.
Depending on what your findings will be - you can:
- Try to use buffers or cache to decrease number of memory allocations. You can also disable memory tracking in EurekaLog;
- You can disable freeze detection;
- You can ignore specific exceptions and/or disable "Catch Handled exceptions" option;
- You can use thread pool instead of multiple thread workers.