[reportlab-users] Is the graphics package slow?

Sebastien Lemieux reportlab-users@reportlab.com
Mon, 29 Mar 2004 16:15:13 -0500 (EST)


  I'm currently considering reportlab to generate nice looking png
graphics to be displayed on dynamic web pages (using Webware).  A typical
graphic is a scatter plot containing around 1000 data points.  A short
test with reportlab (included below) seems to indicate that the generation
time for such graphic is around 1 second (PIII-1.3GHz), which is several
times slower than my current solution (biggles).

  I'd like to know if I'm doing something obviously wrong in my code and 
if any of you see a way to accelerate the process?

Thanks in advance,

from reportlab.graphics.shapes import *
from reportlab.graphics import renderPM
from random import random

data = []
for i in range (1000):
	data.append ((random (), random ()))

def Scatter (fn):

	d = Drawing (400, 400)

	for p in data:
		x = 400 * p[0]
		y = 400 * p[1]
		d.add (Circle (x, y, 2.2))

	renderPM.drawToFile (d, fn, 'PNG')

for i in range (10):
	Scatter ("t.png")

Sebastien Lemieux
Post-doc - Bioinformatics
Elitra Pharmaceuticals Inc.