#16296: Speed improvements for categories with axioms
-------------------------------------+-------------------------------------
       Reporter:  SimonKing          |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  major              |    Milestone:  sage-6.3
      Component:  categories         |   Resolution:
       Keywords:  cython             |    Merged in:
  performance categories             |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  007cccd2eb0d054cc7f9d847664e23a2236b6b9d
  u/SimonKing/ticket/16296           |     Stopgaps:
   Dependencies:  #10963, #15801,    |
  #16309                             |
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 With #15801:
 {{{
 sage: from sage.categories.category_with_axiom import canonicalize_axioms
 sage: L = ["Commutative", "Connected", "Commutative", "WithBasis",
 "Finite"]
 sage: %timeit canonicalize_axioms(L)
 100000 loops, best of 3: 8.23 µs per loop
 sage: L = [Coalgebras(QQ), Sets().Finite(), Algebras(ZZ),
 SimplicialComplexes()]
 sage: %timeit Category._sort(L)
 100000 loops, best of 3: 6.12 µs per loop
 sage: %timeit Category._sort_uniq(L)
 10000 loops, best of 3: 24.7 µs per loop
 sage: %timeit Category.join(L)
 10000 loops, best of 3: 854 µs per loop
 }}}

 With the branch from here:
 {{{
 sage: from sage.categories.category_with_axiom import canonicalize_axioms
 sage: L = ["Commutative", "Connected", "Commutative", "WithBasis",
 "Finite"]
 sage: %timeit canonicalize_axioms(L)
 100000 loops, best of 3: 3.77 µs per loop
 sage: L = [Coalgebras(QQ), Sets().Finite(), Algebras(ZZ),
 SimplicialComplexes()]
 sage: %timeit Category._sort(L)
 100000 loops, best of 3: 5.49 µs per loop
 sage: %timeit Category._sort_uniq(L)
 100000 loops, best of 3: 13.8 µs per loop
 sage: %timeit Category.join(L)
 10000 loops, best of 3: 659 µs per loop
 }}}

 So, there is an improvement of >50% in `canonicalize_axioms`, 44% in
 `_sort_uniq` (but not in `_sort`), and 22% in `join`.

--
Ticket URL: <http://trac.sagemath.org/ticket/16296#comment:37>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to