Skip to content

[Optimization] Add the slots argument to the dataclass. #238

Description

@OldTangyuan

我注意到项目中有使用到大量的数据类实例,并且几乎无数据类实例有添加过新属性。
因此,我认为可以添加slots=True参数来优化内存以及提高属性访问效率,特别是这种使用大量数据类的项目

同时我也建议去使用frozen=True参数以防止数据类在传输过程中被改变,尽管项目中几乎没有会造成这种情况的逻辑。但随着项目复杂化还是很需要使用这个参数的。

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions