#19619: Simplify words.py
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:  Sébastien Labbé
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/19619                 |  13e989e3ab16bcda4980b69d7f6afd65ab46b318
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Some timings with the branch
 {{{
 sage: W = Words()
 sage: FW = FiniteWords()
 sage: L = range(1000)
 sage: %timeit W(L, check=False)
 100000 loops, best of 3: 2.54 µs per loop
 sage: %timeit W(L, length="finite", check=False)
 1000000 loops, best of 3: 1.58 µs per loop
 sage: %timeit W(L, datatype="list", check=False)
 100000 loops, best of 3: 1.75 µs per loop
 sage: %timeit W(L, length="finite", datatype="list", check=False)
 1000000 loops, best of 3: 1.49 µs per loop
 sage: %timeit FW(L, check=False)
 1000000 loops, best of 3: 823 ns per loop
 }}}
 Whereas we have on develop
 {{{
 sage: W = Words()
 sage: %timeit W(L, check=False)
 1000000 loops, best of 3: 800 ns per loop
 }}}
 It looks like the code in the branch is:
  - 3x slower now if nothing is provided
  - 2x slower if length or datatype is provided
  - 1x if call directly `FiniteWords`
 Plenty of reasons: more inheritance, more function calls.

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