Skip to content

Symengine .subs is calling back to Python #410

Open
@peendebak

Description

@peendebak

When executing the symengine subs on just basic types a callback to the python interpreter is make. A minimal example:

import symengine
x,y=symengine.symbols('x, y')
f=x*x+y*y/2
f.subs({x: 1.0, y: x}) # this triggers __instancecheck__ from abc.py

When profiling the expression (with cProfile + snakeviz) we get:

image
(the magenta block is the call back to python)

If the call back to the python interpreter can be avoided, the code is more efficient.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions