Open
Description
Hi I am working with long reports (~100 pages) and in some cases the rendering time is a bit overwhelming. At first I thought the issue was related with loading images (about 4 images / page)
but after some debugging I noticed the code is extremely CPU intensive.
I did some profiling on the report using python profile module on the latest version and I got this:
ncalls | tottime | percall | cumtime | percall | filename:lineno(function) |
---|---|---|---|---|---|
1517881 | 67.733 | 0 | 69.799 | 0 | text.py:667(iter_lines) |
146796 | 13.871 | 0 | 176.298 | 0.001 | text.py:912(split_first_line) |
258624 | 10.651 | 0 | 58.431 | 0 | text.py:828(create_layout) |
258630 | 8.032 | 0 | 28.841 | 0 | text.py:623(init) |
696704 | 7.967 | 0 | 16.909 | 0 | text.py:676(set_text) |
1771847 | 6.502 | 0 | 12.326 | 0 | api.py:225(new) |
518259 | 5.534 | 0 | 5.534 | 0 | init.py:50(call) |
1732555 | 5.067 | 0 | 11.3 | 0 | :1() |
2605233 | 4.607 | 0 | 4.607 | 0 | text.py:864(add_attr) |
1221166 | 4.506 | 0 | 15.512 | 0 | text.py:559(unicode_to_char_p) |
2608573 | 3.498 | 0 | 3.498 | 0 | :0(find) |
258720 | 2.875 | 0 | 6.886 | 0 | surfaces.py:785(init) |
2036614 | 2.584 | 0 | 2.721 | 0 | api.py:163(_typeof) |
146802 | 2.476 | 0 | 9.528 | 0 | text.py:585(first_line_metrics) |
1366910 | 2.303 | 0 | 3.689 | 0 | api.py:396(gc) |
547080 | 2.278 | 0 | 6.154 | 0 | text.py:569(get_size) |
1771847 | 2.148 | 0 | 2.148 | 0 | :0(newp) |
1618829 | 2.041 | 0 | 2.044 | 0 | :0(encode) |
2302764 | 1.87 | 0 | 1.87 | 0 | :0(get) |
1594209 | 1.821 | 0 | 1.821 | 0 | :0(replace) |
27424 | 1.549 | 0 | 12.643 | 0 | init.py:105() |
258857 | 1.412 | 0 | 3.148 | 0 | surfaces.py:130(init) |
1366910 | 1.386 | 0 | 1.386 | 0 | :0(gcp) |
477599 | 1.226 | 0 | 2.115 | 0 | percentages.py:32(resolve_one_percentage) |
258624 | 1.189 | 0 | 1.189 | 0 | text.py:726(get_font_features) |
258831 | 1.113 | 0 | 2.507 | 0 | context.py:103(_init_pointer) |
39037 | 1.092 | 0 | 2.858 | 0 | init.py:477(computed_from_cascaded) |
264768 | 1.018 | 0 | 1.935 | 0 | api.py:276(cast) |
36148 | 1.015 | 0 | 3.573 | 0 | percentages.py:53(resolve_percentages) |
675758 | 0.945 | 0 | 0.945 | 0 | :0(append) |
It looks like over half the time is spent on text.py, since I am not familiar with the code I was wondering if someone could explain a bit more what is happening and if there is something I can do to improve the performance for this specific report.
Best,