Comment 0 for bug 424671

Revision history for this message
Bryce Harrington (bryce) wrote :

[Problem]
Performance processing attachments when referencing the message object really slows things down

[Discussion]
I love launchpadlib and use it a LOT for helping me get my work done on X.org. X.org bugs are really all about file attachments - crash dumps, log files, config files, yada yada. Pretty much every launchpadlib script I write deals with attachments in some way.

However, if you want to get the name of the uploader of the attachment, or when it was uploaded, this causes scripts to run a LOT slower. For interactive scripts this can result in it taking over a minute to load the bug. Even for non-interactive scripts this delay really reduces their usefulness.

I would like to see launchpadlib provide better optimized access to these details.

Attached is a test script I've used to do some performance measurements when different data is requested on a bug's attachments.

\time -f "%E" ./test_attachments.py

Results
======
0. Just titles: 5.18 sec
1. do_a: 12.58
2. do_message: 42.33
3. do_a + do_message: 51.38
4. do_fb: 11.68
5. do_a + do_fb: 17.95
6. do_a + do_fb + do_message: 1:14.90
7. do_content: 11.84
8. do_a + do_content: 24.87
9. do_a + do_fb + do_content: 25.59
10. do_a + do_fb + do_message + do_content: 1:08.76

As you can see, it's faster to get all the files content (including printing contents to the screen!) than to print only the owner/date_created/subject of the file, by like an order of magnitude

Something feels wrong - I would expect the difference between #1 and #3 to be on the order of maybe 4 sec max, not 40 sec. In this example bug, there is only a single message on the bug, compared with like 20 attachments, so you would expect #3 to be faster than #8, not take twice as long.