#16320: Handle finite slices for infinite enumerate sets
-------------------------------------+-------------------------------------
Reporter: tscrim | Owner: sage-combinat
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.3
Component: categories | Resolution:
Keywords: infinite | Merged in:
enumerated set slices | Reviewers: Nathann Cohen
Authors: Travis Scrimshaw | Work issues:
Report Upstream: N/A | Commit:
Branch: | 1998e42335312510b53cea35d9aeabd1b52a9cdf
public/infinite_enum_set_slices-16320| Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by nthiery):
Replying to [comment:20 tscrim]:
> It's an extra function call (plus some extra logic); so it's a micro
optimization but still some speed:
> {{{
> sage: def foo():
> ....: return 5
> ....:
> sage: def bar():
> ....: return foo()
> ....:
> sage: %timeit foo()
> 1000000 loops, best of 3: 504 ns per loop
> sage: %timeit bar()
> 1000000 loops, best of 3: 773 ns per loop
> }}}
> plus it's only a few lines, so I don't see much harm.
Not much I agree. Yet, in general, unless when we really are in a critical
path/section, I'd rather not start manually inlining method calls. If you
add the extra slice and so on the optimization does not make such a big
difference, and it still introduces some duplication: you have to
explicitly look at the code to see that it's doing the same thing. And if
someone has a better `unrank_range` (granted, this is unlikely), you don't
beneficiate from it automatically.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/ticket/16320#comment:21>
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/d/optout.