#10963: Axioms and more functorial constructions
-------------------------------------+-------------------------------------
       Reporter:  nthiery            |        Owner:  stumpc5
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.2
      Component:  categories         |   Resolution:
       Keywords:  days54             |    Merged in:
        Authors:  Nicolas M. Thiéry  |    Reviewers:  Simon King, Frédéric
Report Upstream:  N/A                |  Chapoton
         Branch:                     |  Work issues:  To be merged
  public/ticket/10963-doc-           |  simultaneously with #15801
  distributive                       |       Commit:
   Dependencies:  #11224, #8327,     |  70e7b323cbdd928b9b05182e950bcdc90d2182bc
  #10193, #12895, #14516, #14722,    |     Stopgaps:
  #13589, #14471, #15069, #15094,    |
  #11688, #13394, #15150, #15506,    |
  #15757, #15759, #16244             |
-------------------------------------+-------------------------------------

Comment (by tscrim):

 If you really prefer the `if len(categories) == 0:`, then I won't revert
 it again. However the `if not categories:` is 2x faster:
 {{{
 sage: p = []
 sage: %timeit if p == []: pass
 10000000 loops, best of 3: 197 ns per loop
 sage: %timeit if not p: pass
 10000000 loops, best of 3: 103 ns per loop
 # This test is unfair since it is a machine int vs a Sage int
 sage: %timeit if len(p) == 0: pass
 1000000 loops, best of 3: 627 ns per loop
 sage: a = int(0)
 sage: %timeit if len(p) == a: pass
 1000000 loops, best of 3: 255 ns per loop
 sage: p = range(1000)
 sage: %timeit if p == []: pass
 10000000 loops, best of 3: 178 ns per loop
 sage: %timeit if not p: pass
 10000000 loops, best of 3: 90.6 ns per loop
 sage: %timeit if len(p) == 0: pass     # Again this is unfair
 1000000 loops, best of 3: 616 ns per loop
 sage: %timeit if len(p) == a: pass
 1000000 loops, best of 3: 247 ns per loop
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:708>
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