[IronPython] Performances and Profiling of ReportLab under IronPython

Marco Parenzan marco.parenzan at libero.it
Thu Aug 20 11:26:14 CEST 2009


Dear All,

 

I downloaded IPY2.6beta2 to test this script:

 

from reportlab.graphics.shapes import Drawing, String

from reportlab.graphics import renderPDF

 

d = Drawing(100, 100)

s = String(50, 50, "Hello World", textAlign='middle')

 

d.add(s)

 

renderPDF.drawToFile(d, "HelloWorld.pdf", "HW")

 

IPY 2.0.2 takes 20 seconds; IPY 2.6beta2 about 8! But it takes
long....CPython takes less that a second.

 

I have executed profiling from Curt post
<http://blogs.msdn.com/curth/archive/2009/03/29/an-ironpython-profiler.aspx>
. This is the result (first 15 rows, sorted by calls DESC):

 


Name

Inclusive

Exclusive

Calls


type Builtin: method: chr(Int32)

46543

46543

1453


type Builtin: method: ord(Object)

17910

17910

888


type List: method: append(Object)

11752

11752

468


type Builtin: method: __import__(CodeContext, String, Object, Object,
Object, Int32)

209641377

209641377

380


type Builtin: method: hasattr(CodeContext, Object, String)

771507

771507

317


type Builtin: method: divmod(CodeContext, Object, Object)

99164

99164

262


type PythonDictionary: method: has_key(Object)

48355

48355

218


type Builtin: method: len(Object)

42922

42922

189


type StringOps: method: join(String, List)

19591

19591

182


module colors: class Color: def __init__(self, red, green, blue)

17359

8780

150


module colors: def HexColor(val, htmlOnly)

145565

6839

150


type Builtin: method: isinstance(CodeContext, Object, Object)

6342

6342

146


module pdfdoc: def format(element, document, toplevel, InstanceType)

5712898

6437

114


module pdfutils: def _escape(s): def <lambda$840>(c, d)

4710

2922

108


type StringOps: method: lower(String)

3266

3266

100

 

Sorted by Inclusive:

 


Name

Inclusive

Exclusive

Calls


type Builtin: method: __import__(CodeContext, String, Object, Object,
Object, Int32)

209641377

209641377

380


module renderPDF01

61950185

256

1


module shapes

45433217

1455217

1


module __init__

40333697

53011

8


module site

18405008

1141596

1


module renderPDF: def drawToFile(d, fn, msg, showBoundary, autoSize)

13208473

210

1


module flowables

13108755

64681

1


module os

10374697

101300

1


module paragraph

9988916

104182

1


module colors

9227303

9866

1


module utils

7020300

220690

1


module canvas: class Canvas: def save(self)

6521990

49

1


module pdfdoc: class PDFDocument: def SaveToFile(self, filename, canvas)

6493142

169

1


module pdfdoc: class PDFDocument: def GetPDFData(self, canvas)

6215312

142

1


module pdfdoc: def format(element, document, toplevel, InstanceType)

5712898

6437

114

 

I have not experience: any idea on improving performances? Thanks

 

                Marco [dot] Parenzan [at] libero [dot] it

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090820/50051ffa/attachment.html>


More information about the Ironpython-users mailing list