#14524: Decorator for methods requiring mutability or immutability
----------------------------------------+-----------------------------------
Reporter: SimonKing | Owner: jason
Type: PLEASE CHANGE | Status: needs_review
Priority: major | Milestone: sage-5.10
Component: misc | Resolution:
Keywords: decorator mutability | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
----------------------------------------+-----------------------------------
Comment (by SimonKing):
By the way, here is some data on the overhead:
{{{
sage: from sage.structure.mutability import require_mutable
sage: class A:
....: def bla(self):
....: return 1
....: @require_mutable
....: def blabla(self):
....: return 1
....:
sage: a = A()
sage: %timeit x=a.bla()
1000000 loops, best of 3: 404 ns per loop
sage: %timeit x=a.blabla()
1000000 loops, best of 3: 1.78 us per loop
sage: a._is_immutable = False
sage: %timeit x=a.blabla()
1000000 loops, best of 3: 711 ns per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14524#comment:4>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.