#11382: Speedup subposet and _vertex_to_element
---------------------------------+------------------------------------------
Reporter: hivert | Owner: hivert
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: combinatorics | Keywords: poset, subposet, Cernay2012
Work_issues: | Upstream: N/A
Reviewer: Nicolas M. Thiéry | Author: Florent Hivert
Merged: | Dependencies: #10998
---------------------------------+------------------------------------------
Changes (by nthiery):
* reviewer: => Nicolas M. Thiéry
Old description:
> A lot of unnecessary and redundant check are performed. See a more
> precise
> analyze on
> [http://groups.google.com/group/sage-combinat-
> devel/browse_thread/thread/545480705ce92eaa| this thread] of sage-
> combinat-devel
> {{{
> sage: P = cutting_poset(WeylGroup(['A',4]))
> sage: P.cardinality()
> 24
> }}}
> Before:
> {{{
> sage: %timeit P.subposet(P.list()[1:])
> 5 loops, best of 3: 214 ms per loop
> }}}
> After:
> {{{
> sage: %timeit P.subposet(P.list()[1:])
> 25 loops, best of 3: 24.8 ms per loop
> }}}
> Here is another timing for a bigger poset:
> {{{
> sage: P = cutting_poset(WeylGroup(['A',4]))
> sage: P.cardinality()
> 120
> }}}
> Before:
> {{{
> sage: %timeit P.subposet(P.list()[1:])
> 5 loops, best of 3: 28.8 s per loop
> }}}
> After:
> {{{
> sage: %timeit P.subposet(P.list()[1:])
> 5 loops, best of 3: 597 ms per loop
> }}}
>
> '''Depend on:'''
>
> - #10998
New description:
A lot of unnecessary and redundant check were performed with a preliminary
version of #10998. See a more precise
analyze on
[http://groups.google.com/group/sage-combinat-
devel/browse_thread/thread/545480705ce92eaa| this thread] of sage-
combinat-devel
{{{
sage: P = cutting_poset(WeylGroup(['A',4]))
sage: P.cardinality()
24
}}}
Before:
{{{
sage: %timeit P.subposet(P.list()[1:])
5 loops, best of 3: 214 ms per loop
}}}
After:
{{{
sage: %timeit P.subposet(P.list()[1:])
25 loops, best of 3: 24.8 ms per loop
}}}
Here is another timing for a bigger poset:
{{{
sage: P = cutting_poset(WeylGroup(['A',4]))
sage: P.cardinality()
120
}}}
Before:
{{{
sage: %timeit P.subposet(P.list()[1:])
5 loops, best of 3: 28.8 s per loop
}}}
After:
{{{
sage: %timeit P.subposet(P.list()[1:])
5 loops, best of 3: 597 ms per loop
}}}
This is mostly fixed in the final version of #10998. The attached patch
optimizes it a tiny bit further, and adds doctests.
Apply: [attachment:trac_11382-subposet_to_vertex_speedup-fh.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11382#comment:6>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.