Skip to content

Commit 4a49d23

Browse files
committed
Basic._richcmp_(): Make Rel import global, not inline.
This seems to have a major impact on comparison performance, e.g.: Before: >>> import timeit; timeit.timeit('a == b', 'from symengine import sympy_compat as sp; a = sp.Symbol("a"); b = sp.Symbol("b")', number=10000) 0.3318144249933539 After: >>> import timeit; timeit.timeit('a == b', 'from symengine import sympy_compat as sp; a = sp.Symbol("a"); b = sp.Symbol("b")', number=10000) 0.0019199100061086938
1 parent 653a3fc commit 4a49d23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

symengine/lib/symengine_wrapper.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ from operator import mul
1313
from functools import reduce
1414
import collections
1515
import warnings
16+
from sympy import Rel
1617

1718
include "config.pxi"
1819

@@ -462,7 +463,6 @@ cdef class Basic(object):
462463
return Basic._richcmp_(A, B, op)
463464

464465
def _richcmp_(Basic A, Basic B, int op):
465-
from sympy import Rel
466466
if (op == 2):
467467
return symengine.eq(deref(A.thisptr), deref(B.thisptr))
468468
elif (op == 3):

0 commit comments

Comments
 (0)