-
-
Notifications
You must be signed in to change notification settings - Fork 687
Closed
Closed
Copy link
Milestone
Description
This fixed _cartesian_product_of_elements to bypass _element_constructor and other checks, and documented it; this is particularly relevant after #16269 which introduces more checks and coercion in _element_constructor. Timing difference:
sage: S1 = Sets().example()
sage: S2 = InfiniteEnumeratedSets().example()
sage: C = cartesian_product([S2, S1, S2])
sage: l = tuple([S2.an_element(), S1.an_element(), S2.an_element()])
Without the optimization:
sage: %timeit C._cartesian_product_of_elements(l)
10000 loops, best of 3: 22 µs per loop
With the optimization:
sage: %timeit C._cartesian_product_of_elements(lt)
1000000 loops, best of 3: 922 ns per loop
Depends on #16269
CC: @sagetrac-sage-combinat @nathanncohen
Component: combinatorics
Author: Nicolas M. Thiéry
Branch/Commit: 4512a9e
Reviewer: Nathann Cohen
Issue created by migration from https://trac.sagemath.org/ticket/16288