Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your Trace code creates a list of N graphical objects (one for each point), which implies N-1 mergings of such objects. The alternative is to create one graphical object for all the points :

sage: time P1=points(list(tuple(u) for u in zip(range(5), range(5, 10))))
CPU times: user 68 µs, sys: 11 µs, total: 79 µs
Wall time: 81.3 µs
sage: time P2=list_plot(list(tuple(u) for u in zip(range(5), range(5, 10)))) # Variant
CPU times: user 83 µs, sys: 0 ns, total: 83 µs
Wall time: 84.9 µs
sage: time P3=sum([plot(point(tuple(u))) for u in zip(range(5), range(5, 10))])
CPU times: user 292 µs, sys: 0 ns, total: 292 µs
Wall time: 297 µs
sage: P1.parent()
<class 'sage.plot.graphics.Graphics'>
sage: P2.parent()
<class 'sage.plot.graphics.Graphics'>
sage: P3.parent()
<class 'sage.plot.graphics.Graphics'>
sage: len(P1)
1
sage: len(P2)
1
sage: len(P3)
5

HTH,