GithubHelp home page GithubHelp logo

Comments (4)

dkharrat avatar dkharrat commented on June 12, 2024 1

No, I haven't used use_pyo3 logging. I haven't changed the code. I'm only changing the Nautilus version.

I'm loading both 1-min bar and 5-min bar data, since my strategy subscribes to 5-min bars. The 1-min bars helps with producing more accurate fills.

I did observe something related to that that might provides some clues:

  • When loading only 1-min bar data, and having the strategy subscribe to 1-min bars, the performance on both 1.88.0 and 1.89.0 is similar (around ~30 secs).
  • Also, loading only 5-min bar data and having the strategy subscribe to 5-min bars, the performance on both 1.88.0 and 1.89.0 is similar. (around ~6 secs)
  • However, loading both 1-min and 5-min bar data and having the strategy subscribe to 5-min bars, that's when the performance is different. (~9 secs in 1.88.0 and ~33 secs in 1.89.0).

Did something change related to how bars are loaded or processed?

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

Hi @dkharrat

I can't see anything obvious so far, did you start using the use_pyo3 logging option by any chance?

I generally run some of the example backtests periodically and can't see any significant performance change, I wonder if this might be specific to bars in some way?

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

Hey @dkharrat

Thanks for going through this and providing the extra information. There's a chance this could have something to do with a change to how the message bus processes published messages (including bars), but I'll have to test.

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

So after a lengthy investigation this was tracked down to a subtle edge case with the MessageBus topic resolving.

The issue

A bug was fixed for the 1.189.0 release whereby it became possible to subscribe to topics which previously had messages published with no subscribers.

This change caused a performance regression where messages being published without any subscribers would always go through an expensive topic/pattern resolving operation.

The fix

Now fixed from d28da76 with a simple boolean flag.

Whenever subscribe or unsubscribe is called on the bus, its put back into an "unresolved" state until the next message is published with has no subscribers. There is still an edge case existing where multiple of these "no subscriber topics" could need resolving (and only the first one will resolve), however this at least fixes the most common use case and performance regression.

Let me know if this fix works for you when you get a chance.

from nautilus_trader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.