Skip to content

How does this diverge from Janus? #1

Closed

Description

@Joshuaalbert

Can you explain why someone might choose this over Janus? And vice-versa?

Activity

  1. x42005e1f commented on Mar 18, 2025

    @x42005e1f
    Owner

    Benefits:

    1. Support for more libraries. Culsans inherits aiologic compatibility and thus supports at least 6 (7 if you count AnyIO) different libraries, which gives at least 36 possible communication directions. Janus supports only two: threading and asyncio.

    2. Support for multiple event loops. Unlike Janus, Culsans does not bind to the current event loop, which allows you to use Culsans independently of event loops: you can use Culsans in any combination to communicate between any event loop at the same time. Janus supports only two models: either only normal threads (since 1.2.0 and Python 3.10), or only one asyncio event loop and an arbitrary number of worker threads.

    3. Support for additional methods. Culsans has both useful methods that Janus abandoned, such as atomic queue.clear(), and unique features such as growing & shrinking. This allows Culsans to be used in more scenarios than Janus, which only provides standard methods.

    4. Greater convenience. Culsans works as is and does not require "closing" the queue. This allows Culsans to be used like a normal queue. When working with Janus, in contrast, you need to remember both that it binds to the current event loop when used (when created on Python <3.10), and that it must be closed after use to avoid asyncio warnings.

    5. Better performance. Janus uses existing primitives from the queue and asyncio modules for its work, and initiates the creation of new asyncio tasks in methods such as queue.get_nowait() and queue.put_nowait(). Culsans instead relies on aiologic, and due to this does not create new tasks. It uses one common waiting queue for all, which also reduces the number of operations.

      It is worth noting that Culsans was created before Janus 1.2.0 as a proof of concept. At that time, there was a serious performance gap: Janus was 8 times or more slower in some tests and a thousand times slower in other tests. After a number of PRs (some of which are mine), Janus performance came very close to that of Culsans. But the work to speed up Culsans continues, and mostly by improving aiologic.

    Drawbacks:

    1. Alpha development status. Both aiologic and culsans are new packages that are not yet sufficiently tested. Both are developed by a single person (that's me) in their spare time, with no monetization. It often happens that I will miss something somewhere, and as a result miss some serious bug or even make a regression, and often quite silly (see aiologic's changelog). The audience is also very small, especially with Culsans, so the likelihood of someone other than me finding a bug is very low. Because of this, it can be risky to use my packages in production.
  2. Repository owner locked and limited conversation to collaborators on Mar 18, 2025
  3. converted this issue into a discussion #2 on Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions