h5py/h5py — pull request #305 by tacaswell (2013-06-02 06:07:11+00:00)
Title: Fast `keys`

With files that have a large number of elements generating `F.keys()` can take up wards of a minute for 50,000 groups.

I suspect the problem is that the large number of python function calls/objects involved in iterating through all the object in the `list(self)` call. The re-implementation of `keys` in `Group` takes only a few seconds on the same file.

This snippet will generate test files (be warned they can be big)
```
import h5py
from contextlib import closing

def gen_fake_file(fname, N=10000):
with closing(h5py.File(fname, 'w')) as f:
for j in range(N):
g = f.create_group("time_{n:06d}".format(n=j))
g.create_dataset("x", data=np.random.rand(10000))
g.create_dataset("y", data=np.random.rand(10000))

```