Performance Issues

- [x] https://github.com/tnc-ba/strongTNC/commit/6ae842593105e8a5e1396ff93fc5bd46bab6f9c3#commitcomment-6547634
- [ ] SWID Inventory (E-mail Tobias)
- [ ] Inventory View Performance
- [ ] Log View Performance
- [x] TagStats Model
- [ ] Rename / Move methods (e.g ``get_installed_tags_with_time``, ``get_installed_tags_dict``)
:skull: I tried to measure over 1500 tags (software-ids) via api and it failed here with the usual "too many SQL variables" error. 
We could resolve this with something like this:
```python
def update_tag_stats(session, tag_ids):
    existing_tags_set = get_set_chunked(session, tag_ids)
    new_tags = set(tag_ids) - existing_tags_set

    # chunked create is done by default for sqlite
    # https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create
    TagStats.objects.bulk_create([
        TagStats(tag_id=t, device=session.device, first_seen=session, last_seen=session)
        for t in new_tags]
    )


def get_set_chunked(session, tag_ids):
    block_size = 980
    blocks = int(math.ceil(len(tag_ids) / block_size))
    existing_tags_set = set()
    for i in xrange(blocks):
        ids = tag_ids[i * block_size:(i + 1) * block_size]
        existing_tags = TagStats.objects.filter(device__pk=session.device_id, tag__pk__in=ids)
        existing_tags.update(last_seen=session)
        existing_tags_set.add(existing_tags.values_list('tag__pk', flat=True))
    return existing_tags_set
```