#17021: Faster creation of words by the parent
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  slabbe                 |       Status:  needs_info
           Type:         |    Milestone:  sage-6.4
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  combinatorics          |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  3a26ce48b97c17c16e663c4bd9aff00b83a74cc1
  Sébastien Labbé        |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/slabbe/17021         |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_info


Comment:

 Hello,

 Much cleaner than before! Great!

 Are you sure this is worth it
 {{{
 sage: W = Words([0,1,2])
 sage: l = [0,1,0]*100
 sage: timeit("w = W(l, datatype='list', check=False)", number=2000)
 2000 loops, best of 3: 2.17 µs per loop
 sage: timeit("w = W._word_from_list(l)", number=2000)
 2000 loops, best of 3: 1.55 µs per loop
 sage: cls = W._element_classes['FiniteWord_list']
 sage: timeit("w = cls(W,l)", number=2000)
 2000 loops, best of 3: 717 ns per loop
 }}}
 Having 20% gain with a method that is twice slower than calling the class
 constructor looks useless. If you want speed, use the classes themselves.

 The name `_word_from_list_or_char` is more than confusing. For me `from`
 is about the input not the output. I have nothing against a method
 `_word_from_list` which return whatever it wants, but I would expect it to
 raise an Error if the input is not a list.

 Sometimes you use `MyWordClass(parent=self, data=data)` and sometimes
 `MyWordClass(parent, data)`. Is there a reason why?

 Vincent

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