Added performance tests and significantly improved performance

The initial performance results were:

```
Time spent generate: 0:00:19.827882
Time spent fetching: 0:00:55.469668
```

They are now down to:

```
Time spent generate: 0:00:00.590623
Time spent fetching: 0:00:00.742201
```