Improve Group.get_hosts() performance.

- reduce hosts group list to unique elements faster
- add a cache of already computed hosts group list
Merge pull request #4936 from stoned/group-get_hosts-perf2

Improve Group.get_hosts() performance.