alphagov/govuk_content_api — pull request #97 by alext (2013-04-29 14:08:23+00:00)
Title: Improve performance of /with_tag.json endpoint

This changes the `/with_tag.json` endpoint to only return the details necessary for the browse pages (top-level details + description field).

Some crude tests on my dev VM produced the following:

`ab -n 10 -c 1 'http://contentapi.dev.gov.uk/with_tag.json?section=driving%2Fteaching-people-to-drive'`

Original code:
```
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 3431 3923 350.7 4065 4417
Waiting: 3430 3922 350.7 4064 4416
Total: 3431 3923 350.7 4065 4417
```

New code:
```
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 157 177 14.5 178 195
Waiting: 157 177 14.5 178 195
Total: 157 177 14.5 178 195
```

Digging revealed that there were 2 things that were causing the slowdown:

1. Loading in all the related artefacts and tags
2. Processing the Govspeak fields

These added around 2s each.