Three tips for faster launchpadlib api clients
Wednesday, July 14th, 2010Three tips from Leonard’s lightning talk in Prague about writing faster Launchpadlib API clients:
1. Use the latest launchpadlib. It gets faster from one release to the next. (The versions in the current Ubuntu release should be fine; otherwise run from the branch or the latest tarball.)
2. Profile:
    import httplib2
    httplib2.debuglevel = 1
will show each http request and response, so that you can see what’s taking time.
3. Fetch objects only once:
Don’t do this:
    if bug.person is not None:
        print bug.person.name
instead
    p = bug.person
    if p is not None:
        print p.name
In the first case, the client may fetch the Person object twice. (We may fix this in future.)


