#15715: Teach the graph backend that 'yield' exists in Cython
-------------------------------------+-------------------------------------
       Reporter:  ncohen             |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.2
      Component:  graph theory       |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Nathann Cohen      |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/tscrim/ticket/15715              |  a78ed71c0497c46f26e5de28453bcbf27fb452de
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by tscrim):

 * commit:  be87ba4f553356855239b02bcc3cca0db68978f4 =>
     a78ed71c0497c46f26e5de28453bcbf27fb452de
 * branch:  u/ncohen/15715 => u/tscrim/ticket/15715


Comment:

 I've made some tweaks to squeeze some extra speed out. Here are my
 timings:
 {{{
 sage: G = sage.graphs.base.sparse_graph.SparseGraphBackend(9)
 sage: G.multiple_edges(True)
 sage: G.add_edge(1,2,3,False)
 sage: G.add_edge(1,2,3,False)
 sage: G.add_edge(1,2,3,False)
 sage: G.add_edge(1,2,3,False)
 sage: G.add_edge(1,2,3,False)
 sage: %timeit list(G.iterator_edges(range(9), False))
 100000 loops, best of 3: 15.5 us per loop
 sage: %timeit list(G.iterator_edges(range(9), True))
 100000 loops, best of 3: 16 us per loop
 sage: %timeit list(G.iterator_in_edges([1], False))
 100000 loops, best of 3: 4.8 us per loop
 sage: %timeit list(G.iterator_in_edges([1], True))
 100000 loops, best of 3: 5 us per loop
 sage: %timeit list(G.iterator_out_edges([1], False))
 100000 loops, best of 3: 5.67 us per loop
 sage: %timeit list(G.iterator_out_edges([1], True))
 100000 loops, best of 3: 6.17 us per loop
 }}}
 Before my changes:
 {{{
 sage: %timeit list(G.iterator_edges(range(9), False))
 10000 loops, best of 3: 20.3 us per loop
 sage: %timeit list(G.iterator_edges(range(9), True))
 10000 loops, best of 3: 21.6 us per loop
 sage: %timeit list(G.iterator_in_edges([1], False))
 100000 loops, best of 3: 4.86 us per loop
 sage: %timeit list(G.iterator_in_edges([1], True))
 100000 loops, best of 3: 4.85 us per loop
 sage: %timeit list(G.iterator_out_edges([1], False))
 100000 loops, best of 3: 7.08 us per loop
 sage: %timeit list(G.iterator_out_edges([1], True))
 100000 loops, best of 3: 7.51 us per loop
 }}}
 This will likely be more pronounced as there are more and more multiple
 edges. If you're happy with my changes, then it's positive review.
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=4c76814a054fa7f2dc7b708fe781fb2964425fec
 4c76814]||{{{Merge branch 'u/ncohen/15715' of trac.sagemath.org:sage into
 u/tscrim/ticket/15715}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=a78ed71c0497c46f26e5de28453bcbf27fb452de
 a78ed71]||{{{Tweaks for speed in sparse graph backend for #15715.}}}||

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

Reply via email to