Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

do not call onBar() and onTick() methods in Strategy
 Post subject: do not call onBar() and onTick() methods in Strategy Post rating: 0   New post Posted: Mon 10 Mar, 2014, 23:58 
User avatar

User rating: 0
Joined: Mon 07 Jan, 2013, 23:30
Posts: 19
Location: Ukraine, Odessa
Hello! When I add IFeedListener to Strategy, I don't want to use onBar() and onTick() methods anymore.
I would like to have opportunity to force Strategy do not call them in such case. Because I want to make
my Strategy work as fast as possible, and using of this methods will be waste of time.


 
 Post subject: Re: do not call onBar() and onTick() methods in Strategy Post rating: 1   New post Posted: Tue 01 Apr, 2014, 16:18 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
It's likely that the fastest execution path for you is obtained by simply leaving onBar() and onTick() empty.
If the two methods are called frequently by the engine and become "Hot" as per the criteria of the JIT Compiler, both methods are likely to be re-compiled in realtime as inlined calls.
Since both methods bodies would be empty, this results in a NOOP (No Operation) and subject to further optimisation which means complete removal.
I don't have time to check if there are any default compiler flags you would have to set to guarantee this behaviour in your particular setup (such as -g:none which removes all debugging information, etc) but I would rather rely on realtime JIT optimisations than having the engine introduce conditional if statements. Without having access to the source code we can't suggest a performance conscious refactoring of the codebase to cleanly distinguish between a configuration that calls the IStrategy interfaces and one that delegates away to elsewhere. If the clock cycles used to call empty methods make that much of a difference to you, you're probably using the wrong language (C/C++?) and certainly the wrong client since JFX does a lot of things beyond simply opening a socket connection to the server side and providing callbacks.


 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com