| 70 | In another experiment, I used the [pypi:memory_profiler] on Windows, which provided the following results when rendering a big changeset, for a rendered page weighing 3.53MB: |
| 71 | {{{ |
| 72 | Genshi xhtml: 293.612 total (load=0.017, generate=0.017, filter=0.000, render=293.578) |
| 73 | Filename: d:\Trac\repos\trunk\trac\web\chrome.py |
| 74 | |
| 75 | Line # Mem usage Increment Line Contents |
| 76 | ================================================ |
| 77 | 1283 101.6 MiB 0.0 MiB @profile |
| 78 | 1284 def genshi(): |
| 79 | 1285 101.6 MiB 0.0 MiB buffer = StringIO() |
| 80 | 1286 101.6 MiB 0.0 MiB t5 = time.time() |
| 81 | 1287 101.6 MiB 0.0 MiB stream.render(method, doctype=doctype, out=buffer, |
| 82 | 1288 153.2 MiB 51.6 MiB encoding='utf-8') |
| 83 | 1289 158.0 MiB 4.9 MiB gs = buffer.getvalue().translate(_translate_nop, |
| 84 | 1290 158.0 MiB 0.0 MiB _invalid_control_chars) |
| 85 | 1291 158.0 MiB 0.0 MiB t6 = time.time() |
| 86 | 1292 158.0 MiB 0.0 MiB show_times('Genshi', t2 - t1, t4 - t3, t5a - t4a, t6 - t5, |
| 87 | 1293 158.1 MiB 0.0 MiB method) |
| 88 | 1294 158.1 MiB 0.0 MiB return gs |
| 89 | }}} |
| 90 | |
| 91 | |
| 92 | vs. |
| 93 | |
| 94 | {{{ |
| 95 | Line # Mem usage Increment Line Contents |
| 96 | ================================================ |
| 97 | 1255 101.6 MiB 0.0 MiB @profile |
| 98 | 1256 def jinja(mode='render'): |
| 99 | 1257 101.6 MiB 0.0 MiB if jtemplate: |
| 100 | 1258 101.6 MiB 0.0 MiB j5 = time.time() |
| 101 | 1259 101.6 MiB 0.0 MiB if mode == 'render': |
| 102 | 1260 111.1 MiB 9.4 MiB js = jtemplate.render(jdata) |
| 103 | 1261 111.1 MiB 0.0 MiB j5a = time.time() |
| 104 | 1262 115.4 MiB 4.3 MiB js = js.encode('utf-8') \ |
| 105 | 1263 115.4 MiB 0.0 MiB .translate(_translate_nop, |
| 106 | 1264 106.7 MiB -8.7 MiB _invalid_control_chars) |
| 107 | 1265 106.7 MiB 0.0 MiB j6 = time.time() |
| 108 | 1266 106.7 MiB 0.0 MiB show_times('Jinja2', j2 - j1, 0, j5a - j5, j6 - j5a, |
| 109 | 1267 106.7 MiB 0.0 MiB 'html') |
| 110 | 1268 106.7 MiB 0.0 MiB return js |
| 111 | }}} |
| 112 | |