#11342: Make getattr faster on parents and elements
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.7.1
Component: performance | Keywords: getattr parent element
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9944
---------------------------+------------------------------------------------
Old description:
> If an attribute of a parent or element can not be found by inspecting the
> method resolution order, `__getattr__` is invoked. It tries to obtain the
> attribute from the parent class or the element class of the category of
> the parent. If it can not be found, the attribute error is raised using a
> Cython function `sage.structure.parent.raise_attribute_error`.
>
> I see several ways to make both `__getattr__` and
> `sage.structure.parent.raise_attribute_error` a lot faster. Details will
> be given in the comments.
>
> Because of one doctest in `sage.categories.primer`, it is needed that the
> category of polynomial rings is properly initialised. Therefore:
>
> Depends on #9944
>
> Apply [attachment:trac11342-AttributeErrorMessage.patch]
New description:
If an attribute of a parent or element can not be found by inspecting the
method resolution order, `__getattr__` is invoked. It tries to obtain the
attribute from the parent class or the element class of the category of
the parent. If it can not be found, the attribute error is raised using a
Cython function `sage.structure.parent.raise_attribute_error`.
I see several ways to make both `__getattr__` and
`sage.structure.parent.raise_attribute_error` a lot faster. Details will
be given in the comments.
Because of one doctest in `sage.categories.primer`, it is needed that the
category of polynomial rings is properly initialised. Therefore:
Depends on #9944
Apply [attachment:trac11342-attribute_error_message.rebased.patch]
--
Comment(by SimonKing):
I had to rebase the patch, since it only applied with fuzz 1 against
sage-4.7.1.rc1.
Still needs review.
Apply trac11342-attribute_error_message.rebased.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11342#comment:17>
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.