Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup subposet and _vertex_to_element #11382

Closed
hivert opened this issue May 26, 2011 · 10 comments
Closed

Speedup subposet and _vertex_to_element #11382

hivert opened this issue May 26, 2011 · 10 comments

Comments

@hivert
Copy link

hivert commented May 26, 2011

A lot of unnecessary and redundant check were performed with a preliminary version of #10998. See a more precise
analyze on
this thread of sage-combinat-devel

sage: P = cutting_poset(WeylGroup(['A',3]))
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 basically fixed in the final version of #10998 (run on a
slightly slower machine than for the above timings):

sage: %timeit P.subposet(P.list()[1:])
5 loops, best of 3: 801 ms per loop

The attached patch optimizes it a tiny bit further and adds doctests:

sage: %timeit P.subposet(P.list()[1:])
5 loops, best of 3: 688 ms per loop

Apply: attachment: trac_11382-subposet_to_vertex_speedup-fh.patch

Depends on #10998

CC: @sagetrac-sage-combinat

Component: combinatorics

Keywords: poset, subposet, Cernay2012

Author: Florent Hivert

Reviewer: Nicolas M. Thiéry

Merged: sage-5.0.beta5

Issue created by migration from https://trac.sagemath.org/ticket/11382

@hivert

This comment has been minimized.

@hivert hivert changed the title subposet is too slow Speedup subposet and _vertex_to_element May 29, 2011
@hivert
Copy link
Author

hivert commented May 31, 2011

Dependencies: #10998

@hivert
Copy link
Author

hivert commented Feb 6, 2012

Changed keywords from poset subposet to poset, subposet, Cernay2012

@nthiery
Copy link
Contributor

nthiery commented Feb 8, 2012

Reviewer: Nicolas M. Thiéry

@nthiery

This comment has been minimized.

@nthiery

This comment has been minimized.

@nthiery

This comment has been minimized.

@nthiery
Copy link
Contributor

nthiery commented Feb 8, 2012

comment:9

We finalized the patch together with Florent. Positive review on the version I just uploaded, assuming the test pass (I am running them).

@nthiery
Copy link
Contributor

nthiery commented Feb 9, 2012

@jdemeyer
Copy link

Merged: sage-5.0.beta5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants