[sage-devel] Faster coercions!
This week I worked on the coercion model to make it faster. It turns out that there was some margin for micro-optimizations. There are two tickets in need of review: #26776 and #26790. If you need to be convinced, run sage: a = RR(25); b = ZZ(2) sage: timeit('a+b', repeat=100, number=10) *Before*: 10 loops, best of 100: 756 ns per loop *After*: 10 loops, best of 100: 636 ns per loop This is a very nice gain for every single coercion(!) in Sage. -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Memory leak in poset dimension()
This shows a leak: i = 0 for P in Posets(8): if i % 1000 == 0: gc.collect() print get_memory_usage() i += 1 _ = P.dimension() To compare, width() and height() does not seem to leak. -- Jori Mäntysalo
Re: [sage-devel] Re: Other memory leaks
On Sat, 1 Dec 2018, 'Martin R' via sage-devel wrote: I confirm that the following leaks: I created https://trac.sagemath.org/ticket/26795 for this and similar. -- Jori Mäntysalo
[sage-devel] Re: Other memory leaks
I confirm that the following leaks: def bad8(n): """ sage: bad8(10) """ from sage.graphs.independent_sets import IndependentSets G = Graph(2) for i in range(n): x = [0] in IndependentSets(G) if i % 1 == 0: print get_memory_usage() -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Other memory leaks
For example PS_all_new_cells in src/sage/groups/perm_gps/partn_ref/data_structures.pyx contains bitset_init(scratch, n) but there is no bitset_free(scratch) anywhere. Does that mean that the function leaks memory? Then, in src/sage/graphs/independent_sets.pyx the class IndependentSets seems to have a __dealloc__() thas does NOT contain bitset_free(current_set) and so I guess we have exactly same problem that in breadth_first_search() we are just correcting. As a counter-example, in src/sage/graphs/weakly_chordal.pyx there is function is_long_hole_free() containing bitset_init(dense_graph, n * n) if ...: bitset_free(dense_graph) return ... bitset_free(dense_graph) return ... so that seems to be correct. I found these by egrep -R -o 'bitset_init\([[:alnum:].]+,|bitset_free\([[:alnum:].]+' src/sage | less but I suppose that there are better tools for this. -- Jori Mäntysalo
Re: [sage-devel] the command: "E = EllipticCurve('14a1') K. = E.division_field(5); K" never finishes
On Sat, 1 Dec 2018 at 08:42, Steven Craighead wrote: > E = EllipticCurve('14a1') > K. = E.division_field(p); K for p = 2 and 3 finishes quickly. When I > use p = 5 or p = 7, the command never finishes. > The docstring warns (do E.division_field? to see it) that "This takes a very long time when the degree of the division field is large (e.g. when p is large or when the Galois representation is surjective)." Now for this curve sage: G=E.galois_representation() sage: G.image_type(5) 'The image is all of GL_2(F_5).' sage: GL(2,GF(5)).order() 480 so you are constructing a field of degree 480 over Q. This is done in two steps, first to form the splitting field of the 5-division polynomial : sage: E.division_polynomial(5) 5*x^12 + 5*x^11 + 280*x^10 - 2095*x^9 - 3765*x^8 - 8550*x^7 - 40320*x^6 + 66490*x^5 - 341085*x^4 + 292705*x^3 - 182920*x^2 + 867445*x - 386051 which will have degree 240, and then there's an additional quadratic extension on top. So it is not surprising that this takes a lot longer than the 2- or 3-division fields which are (for this curve) only of degree 2. > > I use Sagemath 8.4 on a linux mint 19. This is a toshiba AMD Turion II > Dual Core Process M500 with 4GB ram. This is a Pentium 64-bit. > > -- > 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 sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] memory problem
needs review. -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] the command: "E = EllipticCurve('14a1') K. = E.division_field(5); K" never finishes
E = EllipticCurve('14a1') K. = E.division_field(p); K for p = 2 and 3 finishes quickly. When I use p = 5 or p = 7, the command never finishes. I use Sagemath 8.4 on a linux mint 19. This is a toshiba AMD Turion II Dual Core Process M500 with 4GB ram. This is a Pentium 64-bit. -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] memory problem
On Sat, 1 Dec 2018, 'Martin R' via sage-devel wrote: https://trac.sagemath.org/ticket/26794 I don't think that this is critical. The user never gets wrong answers because of this. Anyways, needs to be corrected. This is cython thing, not python. I'm not familiar with cython, so maybe someone else should look at this. OTOH I suppose this is an easy one, just add a destructor function (whatever it is called in cython). Harder one is to search for other similar bugs. -- Jori Mäntysalo
Re: [sage-devel] memory problem
https://trac.sagemath.org/ticket/26794 Am Samstag, 1. Dezember 2018 08:57:36 UTC+1 schrieb Martin R: > > OK, here is code that certainly leaks and confirms what you found, Jori. > Congratulations! > > def check_bad5(n): > """ > > sage: check_bad5(10) > > """ > G = Graph(2) > for i in range(n): > x = 0 in G.breadth_first_search(0) > if i % 1 == 0: > print get_memory_usage() > > Martin > -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.