By the way, the discussion at this issue is relevant: 
http://code.google.com/p/sympy/issues/detail?id=1884

Aaron Meurer

On Apr 30, 2011, at 5:20 PM, Vinzent Steinberg wrote:

> On Apr 30, 7:36 pm, Haz <christian.mu...@gmail.com> wrote:
>>> I think the only problem could be that ask() is much slower for
>>> trivial queries, needs to be verified. This should be not too hard to
>>> fix though.
>> 
>>   I don't think this is the case. Trivial queries (those that already have
>> obvious implications) are compiled into quick reference dictionaries. In
>> particular:
>> -https://github.com/sympy/sympy/blob/master/sympy/assumptions/ask.py#L114
> 
> Thanks for clarifying. I made a quick unrepresentative benchmark:
> 
> In [1]: x = Symbol('x', positive=True)
> 
> In [2]: global_assumptions.add(Assume(x, Q.positive))
> 
> In [3]: %timeit x.is_positive
> 1000000 loops, best of 3: 418 ns per loop
> 
> In [4]: %timeit ask(x, Q.positive)
> 10000 loops, best of 3: 97.3 us per loop
> 
> 
> I think this is fast enough. (Even if it is about 200 times slower.)
> 
> Vinzent

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to