[SCHEMA] Improve API performance, part 1.

Summary:
 * Rewrite the code that interprets API query parameters into SQL, and move it
   from models/lens.py to api/filtering.py. Eagerly load a few attributes in
   order to make computing API representations of objects much faster.

 * Store some additional data in Thread objects, so we don't have to compute it
   by loading the thread's messages.

 * Also add a 'profile' decorator in inbox/util/debug.py that can be used for
   selective performance analysis.

Test Plan:
Unit tests updated to directly exercise the API
(tests/api/test_filtering.py)

Reviewers: spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D210