Skip to content

[Performance] Make serialization support enabled optionally #1781

Open

Description

@Martin-Molinero

Environment

  • Pythonnet version: latest/current master
  • Python version: *
  • Operating System: *
  • .NET Runtime: *

Details

With the objective of achieving the fastest pythonnet as possible, we've detected that there's a significant performance hit with the serialization feature. Specifically we saw the following pain points but there might be more:

It seems it could be enabled on demand based on a static configuration value maybe?

Activity

  1. lostmsu commented on May 2, 2022

    @lostmsu
    Member

    I suppose the HashSet involvement can be put behind a boolean flag like Runtime.Dangerous.AllowUndefinedShutdownBehavior. Without it the process may crash with segfault when Python or .NET runtime is unloaded when the process is stopping. Alternatively, you may try to re-engineer that bit to use a more performant collection, like a linked list. You would likely have to store some data on the Python side though.

    At the first glance the MaybeType <-> Type conversions could be restricted to SaveRuntimeData and RestoreRuntimeData, and the type of cache set to Dictionary<Type, PyType>.

    PRs are welcome.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions