Skip to content

Can Program.__add__'s performance be improved? #471

@asaites

Description

@asaites

This is the current implementation of __add__ for a Program:

    fn __add__(&self, rhs: Self) -> Self {
        self.clone() + rhs
    }

Obviously this requires cloning both self and rhs (when it crosses the Python->Rust boundary), which is not ideal. We might be able to make use of rhs to avoid the clone.

Alternatively, we might be better off implementing __radd__ instead, but we should benchmark the difference to find out.

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