#11900: Serious regression caused by #9138
------------------------------+---------------------------------------------
Reporter: SimonKing | Owner: tbd
Type: defect | Status: needs_work
Priority: critical | Milestone: sage-4.8
Component: performance | Keywords: categories regression
Work_issues: | Upstream: N/A
Reviewer: Jeroen Demeyer | Author: Simon King
Merged: | Dependencies: #9138 #11911
------------------------------+---------------------------------------------
Changes (by nthiery):
* status: needs_review => needs_work
Comment:
We discussed this patch quite some with Simon. One of the issue that
came up is whether it was ok to replace the nice idiom `X in Fields()`
(or friends) with `X.is_field()` when time is critical. I consider
that those two idioms have different semantic: `X in Fields()` means:
do we already know that `X` is a ring (that is, X.category() is a
subcategory of has Fields()), whereas X.is_field() may launch an
expensive computation to detect whether X is actually a field or not.
The change was motivated by the fact that, in may important cases,
``X.is_field()``
is much faster than ``X in Fields()``:
{{{
sage: R = QQ['x']
sage: %timeit R.is_field()
625 loops, best of 3: 442 ns per loop
sage: %timeit R in Fields()
625 loops, best of 3: 18 µs per loop
}}}
However, after experimenting together, we found out that the
difference can most likely be made not so significant.
The patch I just attached is a good step in that direction.
Simon is currently experimenting with an implementation of
Cython methods within Python classes.
Hopefully, with that patch or some variant thereof, the changes ``X in
Fields()`` -> ``X.is_field()`` in trac11900_category_speedup.patch can
be reverted while still solving the original regression.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11900#comment:96>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.