-
Notifications
You must be signed in to change notification settings - Fork 33
WIP: Added 'order' keyword argument to cartesian product #40
base: master
Are you sure you want to change the base?
WIP: Added 'order' keyword argument to cartesian product #40
Conversation
Does introducing the extra branch into |
I haven't checked. I assumed that it would be negligible, but I can look into it. I am curious about what you mean by the type parameter encoding of the order, though. |
This seems concerning from both a performance and API perspective. It may be that so much other stuff is going on when iterating a product iterator that the branches don't matter, but it may. I'm also not thrilled about this as an API. |
One way to address the potential performance issue is to have different As for the API, let me wade through On Tue, Feb 17, 2015 at 10:10 AM, Stefan Karpinski <[email protected]
|
I seriously doubt an extra branch makes any difference at present. If we're worrying about performance, a much bigger concern is that |
The branch would be perfectly predictable so it would have nearly zero cost. |
Here is a shot at a different API, based on a suggestion by @blakejohnson There is no (runtime) branching on There are some types in Comments welcome. |
@marcusps maybe you and I should set aside some time this week to try to resolve this. |
Sounds good @blakejohnson On Mon, Nov 9, 2015, 9:41 PM Blake Johnson [email protected] wrote:
|
A simple fix to #37
Currently it only handles anti-lexicographical (the default) and lexicographical ordering (the new addition). The
order
keyword argument takes a boolean argument, not because I thought it was a great idea, but because I could not think of a better one. I suppose an enum of the supported orderings would be the proper type for theorder
argument, but until enum support in Julia lands, I don't have a better idea.The way the two orderings are handled could also be cleaner. If we really think there is a need/demand for more orderings, should each ordering have a different type, selected via the
order
argument?These issues aside, the code can be merged.
Comments welcome.