GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Performance] Make serialization support enabled optionally · Issue #1781 · pythonnet/pythonnet

[Performance] Make serialization support enabled optionally #1781

New issue
Copy link
New issue
Copy link
Open
Open
[Performance] Make serialization support enabled optionally#1781
Copy link

Description

@Martin-Molinero
Martin-Molinero
opened on May 2, 2022
Issue body actions

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:

  • MaybeType<->Type conversions see https://github.com/pythonnet/pythonnet/blob/master/src/runtime/TypeManager.cs#L99
  • Keeping track of objects in HashSet see for example https://github.com/pythonnet/pythonnet/blob/master/src/runtime/Types/ClrObject.cs#L15

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

Activity

  1. lostmsu commented on May 2, 2022

    @lostmsu
    lostmsu
    on May 2, 2022
    Member
    More actions

    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.

    Reacted by Martin-Molinero
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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.