Skip to content

[RFC] Make PyXXXXMethod static #4295

Open
@discord9

Description

@discord9

Summary

Releated static is

  • PyNumberMethod
  • PyMappingMethod
  • PySequenceMethod
    for now, they are using AtomicCell for storing methods, however, crossbeam-utils 0.8.10 make AtomicCell must impl Drop(Because internally it's become a MaybeUninit), so PyXXXXMethod can't be made static

Detailed Explanation

The current method #4293
Using Lazy will cause overhead for every visit. But according to this: https://docs.rs/crossbeam-utils/0.8.10/src/crossbeam_utils/atomic/atomic_cell.rs.html#33-47. using MaybeUninit can prevent some unsound, so I have no idea what we can do here to remove this overhead

Drawbacks, Rationale, and Alternatives

Using Lazy for static have overhead, which might be unnecessary.

Unresolved Questions

I have no idea what we can do here to remove this overhead of using once_cell::sync::Lazy

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRequest for comments

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions