Using a DLL does NOT guarantee performance improvement

Discussion in 'Automated Trading' started by endsongs, Jun 2, 2011.

  1. Awhile back, I did a speed comparison using a DLL compared to compiled/interpreted EZ language. I ran both of them as they would be executed by my platform. The results for a million runs may surprise you.

    1 million runs EZ language compiled/interpreted code: 203 millisec

    1 million runs DLL: 781 milliseconds

    Since the DLL needs over 5 parameters to call it, the overhead from these calls seems to outweigh any edge from pure compilation.
  2. dyson


    What language and compiler did you use for the DLL?

    From my own experience and testing with using a C based DLL (VS 2010), the overhead is within the EL interpreter.
  3. C++ and freeware compiler. Try running your strat both ways and see if there is a difference. The DLL has to run as part of EL on my platform so I only timed around the DLL or EL code.
  4. Instead of giving a DLL example, dozens of which can be found on the net, here is an example of using the timer to speed up code.

    The code below was run 1million times using value56=6 and value56=10

    If value56=10 then
    Begin end
    Else if value56=9 then
    Else if value56=8 then
    Begin end
    Else if Value56 =7 then
    Begin end
    Else if value56=6 then
    Begin end;

    For value56=10 it took 32milliseconds and for value56=6 it took 173millisecs. So, obviously, to speed up this code by perhaps 100millisecs per 1million runs you would code the most likely event first and the least likely last to skip more checks.

    I would suggest that anyone who wants to improve their code write or find a timer that is accurate down to milliseconds. Use it to find places where the code can be re-arranged to speed things up
  5. I am not a programmer but i t think to optimize the speed of a code is an important issue. Thank you for sharing