On Mon, Oct 31, 2011 at 06:38:22AM -0700, Simon King wrote: > Here is an example that shows that your idea is very good, speedwise: > Timings: > sage: %timeit R in C.all_super_categories() > 625 loops, best of 3: 8.69 µs per loop > sage: %timeit RC in C.all_super_categories() > 625 loops, best of 3: 26 µs per loop > sage: %timeit R in C._all_super_categories_list > 625 loops, best of 3: 7.74 µs per loop > sage: %timeit RC in C._all_super_categories_list > 625 loops, best of 3: 25.2 µs per loop > sage: %timeit R in C._all_super_categories_tuple > 625 loops, best of 3: 7.77 µs per loop > sage: %timeit RC in C._all_super_categories_tuple > 625 loops, best of 3: 25.3 µs per loop > sage: %timeit R in C._all_super_categories_set > 625 loops, best of 3: 1.47 µs per loop > sage: %timeit RC in C._all_super_categories_set > 625 loops, best of 3: 1.58 µs per loop
Pretty convincing indeed :-) > However, using #11115, it would still make sense to have > C.is_subcategory(R) as a cached method: It would return the cached > answer in a a few hundred nanoseconds. At a little memory price. But I don't know how many negatives test we are having in average, so whether this is any problem. An alternative would be to have is_subcategory cythoned. Actually, maybe all of Category should be eventually cythoned. But let's keep that for later. Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org