Hi Jori,

On 2014-09-14, Jori Mantysalo <[email protected]> wrote:
> Start with
>
> L=[x for x in Posets(7)]
>
> and then try again.

Right, there is a difference now:
  sage: %time len([x for x in L if x.is_bounded() and x.is_lattice()])
  CPU times: user 193 ms, sys: 2 ms, total: 195 ms
  Wall time: 195 ms
  53
  sage: %time len([x for x in L if x.is_lattice()])
  CPU times: user 1.22 s, sys: 5 ms, total: 1.23 s
  Wall time: 1.23 s
  53

As I said, it is conceivable that there is some caching going on, cause
if I repeat now, I obtain
  sage: %time len([x for x in L if x.is_bounded() and x.is_lattice()])
  CPU times: user 124 ms, sys: 1 ms, total: 125 ms
  Wall time: 124 ms
  53
  sage: %time len([x for x in L if x.is_lattice()])
  CPU times: user 321 ms, sys: 1 ms, total: 322 ms
  Wall time: 322 ms
  53

Concerning the rest of the difference: If you just ask for the posets x
so that x.is_bounded(), then only 63 remain. Hence, x.is_lattice() will
only be called 63 times when you do `x.is_bounded() and x.is_lattice()`.
But when you directly ask for `x.is_lattice()` then it is called
len(L)=2045 times.

In other words, if `x.is_bounded()` is faster than `x.is_lattice()`
then obviously
  len([x for x in L if x.is_lattice() and x.is_bounded()])
will be slower than
  len([x for x in L if x.is_bounded() and x.is_lattice()])

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" 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-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to